Subject: Newbie .... 2004-03-13 - By Andreas Weber
Back If you are publishing for Flash Player 6 or higher it's preferable to use the 'new' event handler model.
Let's say your script on(press){...} is attached to a button clip with the instance name loadBtn_mc you can simply rewrite the handler like
loadBtn_mc.onRelease = function(){ loadMovie ("tshirt.swf",chargeur_clip); }
Put this code in the first frame of the timeline where the loadBtn_mc appears/resides on. You could also use a onPress event, but usually onRelease is prefered because this gives the user the possiblility to still change his mind while clicking: if the mouse is then draged away from the button and released outside, the button action does not take place (thus behaving along the user's expectations).
Now, to monitor the load progress add this code on the same frame:
loadBtn_mc.onEnterFrame = function(){ var loaded = chargeur_clip.getBytesLoaded(); var total = chargeur_clip.getBytesTotal(); if(total > 15 && loaded >= total){ trace('tshirt.swf completely loaded'); delete this.onEnterFrame; } }
Keep in mind that to access the properties of (former) tshirt.swf you now do this through chargeur_clip. If you have a function with the name test inside tshirt.swf, you now call this function like:
chargeur_clip.test();
You do not use the identifier 'tshirt' anymore.
HTH -- ---- ------ Andreas Weber motiondraw.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|