ActionScript 2.0 :: Trigger A Function On A Frame From A Movieclip?
May 15, 2007
well i have a function written on frame one but i want it to get triggered on the on ClipEvent handler of a movie clip that is placed on frame 2. but it doesn't seems to work...
as on frame one
function textBoxVal() {
test2 = "hello";
}
I really just want to know how to trigger a function when my movie hits a certain frame.
I made a very simple flash show to try to illustrate my problem a little more clearly. I have a green and a gray button. Using the 'switch_buttons' command I turned the gray button invisible at the beginning. What I then want to happen is that on the 10th frame the green button will become invisible and the gray button will appear. But I haven't had any luck. It seems like I need to call a function to switch the buttons somehow.
I have a bunch of event listeners that refer to different movieclips but trigger the same function.I have an if statement within this function that I need to trigger if the function is triggered by a specific movieclip.
THE BIG PROBLEM IS, WHEN I AM IN THE OTHER FRAME, IT STILL WORKS. FOR EXAMPLE I AM IN FRAME 2. AND WHEN I PRESSED(SPACE BAR) or Key.getCode() == 32. IT WILL GO TO "Main" how can i stop this function after i click it
Is it possible to call a FrameListener function so that when a movieclip enters a certain frame, I can call a function. ________________Wallpaper_mc My setup is Stage< __________________HUD - Classes_mc
When Classes_mc goes to its "close" frame, I want to call wallpaper_mc to gotoAndStop("unblur")
I have an event listener attached to a movie clip. The corresponding function has an instance of the loader class. So I am getting error #1034, coercion failed.
My thought is to have the event listener trigger a neutral function which itself will trigger the function with the loader class instance.
I have a movieclip running inside a movieclip and i want trigger an action on the timeline in AS2 I would put _root.gotoAndPlay("start6_fl"); or _parent.gotoAndPlay("start6_fl"); depending on were I wanted to go.How do you do this really simple action in AS3?
I have a button (instance is called resbutton) and I would like it to play a specific frame (frame 13) when clicked on. Flash says I cannot add actions to the buttin itself so I made an Actionscript layer and so far just have:
I am attempting to create an interactive piano. Right now, I have my keys layed out and each key is a button. On the down frame of that button is where the sound plays. What I want to do now is to allow the user to press a button and when they do so, the down frame of that button will trigger, thus playing the sound.
I am more towards the art end of the art - developer spectrum, but have some experience with Flash MX and I am making the somewhat painful transition to AS3I have some longish mcs with animation using guides.I am using frame labels in those mcs to trigger other animations with syntax like:
ActionScript Code: if (mc.currentLabel == "label"){ //do something
I need to trigger 4 different functions when I move the mouse poiter over a movieclip; do I need to use 4 listeners or can I use only one to call all the 4 functions?
Now I do this movieclip.addEventListener(MouseEvent.MOUSE.OVER, function1); movieclip.addEventListener(MouseEvent.MOUSE.OVER, function2); movieclip.addEventListener(MouseEvent.MOUSE.OVER, function3); movieclip.addEventListener(MouseEvent.MOUSE.OVER, function4);
In stage Number of MovieClips is there. and MovieClips inside some functions is there .iam giveing dynamic property to MovieClips same as function name.because iam click the MovieClip call the function.
mc.functionName="dosome()" mc.addEventListener(MouseEvent.CLICK,call_inside_function) function callinsidefunction(event:MouseEvent){ /// event.target.functionName
I want a function to be triggered when a certain global var becomes true - I want to do this using an event listener. I can do it as a one off using an if statement, but how do you set up a listener to trigger the function if the value becomes true at any time?
I need to trigger a function or reset a variable from within a sprite when it gets to a certain frame. I keep getting the error "Call to a possibly undefined method" when I call a function and I get "Access of undefined property" when I try to reset the variable directly. Both the function and variable are set globally in the first frame of my animation.
I have a simple f4V file that I am playing through the FLVPlayback component. It is working great. I even have a cue point in there, and it is firing off what it is supposed to do.
However, what I am curious about is if there is a way to detect when the file is done playing in order to fire off a function?
I suppose I could do it with a cue point, but I am going to need to do this a lot, and don't want to have to place cue points in all my videos.
I have found a lot of conflicting info on this subject, and am not sure how to do it, but it doesn't seem like it should be too hard.
I cant figure out how to trigger different url requests from my xml in one function.
Code: Select allprivate function drawButtonsFromXML(loadedXML:XML) { var xmlInfo:XMLList=loadedXML.main.button; for each (var xButton:XML in knappInfo) {
[code]...
So in other words.. Im getting all the names from the xml and adding them to the stage. But i dont know how to add the @site to the different buttons.
I'm having a bit of trouble figuring out why I can't trigger the function playUntil, which is another private function in this class, in this snippet. This is all residing in a class, and I'm wondering if that is what is making things tricky. Any help would be great. I tried tracing out currentTween.obj as well as currentDestination, both of which return undefined.
I am in the final stages of building my new web site: http:[url]....On most of the pages in the portfolio there is a video "Commentary" link (top right corner).Each of the commentaries are flv called up by f.ex:
myMCL.loadClip("http:url.....);
Once the video is done playing, it fades to black.I would really like the flv to trigger an event to send the playhead to another frame and load another swf.I could use a pause command and let the main time line pause so many milliseconds and then proceed, but it is probably not consistent how long it takes each viewer to download the video and watch it.
I am using the following key listener to trigger a login function: code: var keyListener:Object = new Object(); keyListener.onKeyDown = function() { if (Key.isDown(Key.ENTER)) { login(); }} Key.addListener(keyListener);
However this triggers the login function twice, which causes the user to get a error saying they are already logged in. I have a button on the stage which triggers the same function. code: login_btn.onRelease = login; And this works fine. How I can ensure that the keylistener only triggers the login function once?
I'm making a site that loads external swfs based on which button is clicked. When the swf loads it plays an intro and then stops at a certain point. My goal is that when you click another button the current swf plays an outro before the next one loads.The problem I'm having is making the outgoing movie trigger the function that loads the next.At first I tried just adding loadNextMovie(); to the last frame of the loaded swf. But for some reason this causes the two stops in the file from working so the thing just keeps looping. I have no idea why adding this function call would prevent stop(); from working.Is there another way to have the end of movie trigger the function? Also, why doesn't adding loadNextMovie(); to the last frame of the loaded swf work?