View Full Version : Noob question about .swf embedding
hapimp
June 13th, 2008, 11:23 AM
Hi all
Im having a problem with a mov embedding in a swf file. What i want to achieve is to trigger a function when the swf file has stopped playing. For some odd reason i cant figure this out. My code is this:
import fl.motion.MotionEvent;
stop();
var pictLdr:Loader = new Loader();
var pictURL:String = "trafik1.swf"
var pictURLReq:URLRequest = new URLRequest(pictURL);
pictLdr.load(pictURLReq);
trafik1_mc.addChild(pictLdr);
trafik1_mc.addEventListener(Event.COMPLETE, remove);
function remove(event:Event)
{
trace("t");
trafik1_mc.removeChild(pictLdr);
}
sorry for the noob question, hope you can help
/esben
MrTerrible
June 13th, 2008, 12:43 PM
Hi all
Im having a problem with a mov embedding in a swf file. What i want to achieve is to trigger a function when the swf file has stopped playing. For some odd reason i cant figure this out. My code is this:
...
trafik1_mc.addEventListener(Event.COMPLETE, remove);
...
sorry for the noob question, hope you can help
/esben
MovieClip has no Event.COMPLETE event.
You may add your own event at the end of the swf, or you may check if it is still playing:
addEventListener(Event.ENTER_FRAME, onEnter);
function onEnter(evt:Event):void
{
if (your_mc.currentFrame == your_mc.lastFrame) {removeMC()}
}
It's not the most beautiful solution, but it might work, I hope :-)
hapimp
June 13th, 2008, 01:17 PM
Thanks for your reply Terrible. Ive been messing about with it a bit, but it does not seem to work. It seems that your_mc.currentFrame always returns 1. I guess that this is because the progression of frames takes place in the child og your_mc? My problem then, is how to access the timeline of the child of your_mc.
Anyone has an idea of how to get this?
PS. I also am having a bit of problems with lastFrame. Is this a AS3 thing? It doesnt 'turn blue' in my Flash document.
Thanks again,
/esben
MrTerrible
June 13th, 2008, 01:33 PM
PS. I also am having a bit of problems with lastFrame. Is this a AS3 thing? It doesnt 'turn blue' in my Flash document.
Thanks again,
/esben
Oppps, sorry. It should be 'totalFrames'.
hapimp
June 13th, 2008, 03:01 PM
Thank you, i changed it now. It does not make any difference though, since your_mc currentFrame is always 1 (and so is totalFrames)?! I need to get to your_mc's child's (pictLdr) timeline, and read the frames from there. any ideas?
/esben
hapimp
June 13th, 2008, 04:11 PM
Nevermind guys, i found another solution. Thanks for your time.
/esben
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.