homepage Welcome to WebmasterWorld Guest from 54.227.77.237
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Preload message hidden before swf appears
trapezechic




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

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...]

 

rocknbil




msg:4202820
 3:48 pm on Sep 16, 2010 (gmt 0)

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.

trapezechic




msg:4202968
 8:29 pm on Sep 16, 2010 (gmt 0)

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...

trapezechic




msg:4202969
 8:31 pm on Sep 16, 2010 (gmt 0)

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...

rocknbil




msg:4204075
 5:01 am on Sep 20, 2010 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved