Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: open

Preload message hidden before swf appears

   
8:29 pm on Sep 14, 2010 (gmt 0)

5+ Year Member



Not sure if this post should be in the flash forum or the javascript...

I am using a script to hide a load message when the page is finished loading but the script is running before my swf content is loaded. Any ideas?

My url is: [inspaceathome.com...]
3:48 pm on Sep 16, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



This

<body onload="hideLoad()">

or more appropriately this


<script type="text/javascript">
window.onload=function() { hideLoad(); }
function hideLoad() {
document.getElementById("load").style.visibility="hidden";
}
</script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<body>


means "as soon as the page is loaded, execute hideLoad()." Since the files are cached after the first time in, it's going to hide it immediately even though the elements withing your Flash object aren't loaded. The .swf itself is cached.

Here is what I would do. First, since you're already using SWFObject, get it working and don't use the (invalid HTML) <object><embed></object method. Then you have

<div id="my-placeholder"><a href="http://www.adobe.com/go/getflashplayer"><img src="loading-flash-image.jpg" alt="Loading Flash, get the Flash Player here"></a></div>

What SWFObject does is then replaces the innerHTML of my-placeholder width your Flash.

Then in your Flash, you do a preload, lots of samples out there. Frame 1 executes code to load all the objects. You set a variable data_loaded=0 until your preload function gets all the data. Frame 2 is

if (data_loaded==0) { gotoAndPlay(1); }
else { gotoAndPlay(3); }

So I'm saying, move your preload within the Flash.
8:29 pm on Sep 16, 2010 (gmt 0)

5+ Year Member



Okay. I get what you are saying, but since I know virtually nothing about Flash, I could use a little clarification on the execution...

First, since you're already using SWFObject, get it working and don't use the (invalid HTML) <object><embed></object


I am using Dreamweaver and the code that is there was automatically generated when I inserted my flash object.

<div id="my-placeholder"><a href="http://www.adobe.com/go/getflashplayer"><img src="loading-flash-image.jpg" alt="Loading Flash, get the Flash Player here"></a></div>


Does this line of code replace the whole segment?

Then in your Flash, you do a preload, lots of samples out there.


I used the preload actionscript:

stop();

ifFrameLoaded (_totalframes) {
gotoAndPlay ("start");
}

but the loading frame doesn't show...
8:31 pm on Sep 16, 2010 (gmt 0)

5+ Year Member



Okay. I get what you are saying, but since I know virtually nothing about Flash, I could use a little clarification on the execution...

First, since you're already using SWFObject, get it working and don't use the (invalid HTML) <object><embed></object

I am using Dreamweaver and the code that is there was automatically generated when I inserted my flash object.

<div id="my-placeholder"><a href="http://www.adobe.com/go/getflashplayer"><img src="loading-flash-image.jpg" alt="Loading Flash, get the Flash Player here"></a></div>

Does this line of code replace the whole segment?

Then in your Flash, you do a preload, lots of samples out there.

I used the preload actionscript:

stop();

ifFrameLoaded (_totalframes) {
gotoAndPlay ("start");
}

but the loading frame doesn't show...
5:01 am on Sep 20, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I am using Dreamweaver and the code that is there was automatically generated when I inserted my flash object.


I know . . . don't get me started on all the outdated stuff DW does. :-)

Does this line of code replace the whole segment?


Yes . . . check out some of the simple tutorials - but you have to use the code window.

SWFObject [code.google.com]

I used the preload actionscript:


Right, but that won't work with this. It checks the load of the frames, not the data you are loading. You have to look up some special event handlers to check when the picture is fully loaded. I'd help more but in a remote location ATM.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month