ActionScript 3.0 :: Removing Eventlistener On Main Timeline Using Code Within Mc?
Feb 2, 2011
I have an event listener on my main timeline and I have an mc with some AS which sits on the main timeline. I was just wondering if the following code is correct if I wanted to remove the event listener on the maintimeline from the AS written in the mc.
I'm looking for a way to have my main timeline code interact with code inside of a symbol.I'm tying to get my timeline inside the symbol to gotoAndPlay(10) when something happens in my main timeline code.
I need to find out how i can add those same movie clips on the main timeline with code..So i need to figure out how to take objects from the library and add them on stage (main timeline) using code..
I have no trouble invoking a Class using the code on the main timeline shown below; var testClass:MyClass = new MyClass(); //code on maintimeline invoke Class. However, if I were to remove this code and just use the Flash Class Input Field and insert; MyClass //the name of the Class. I get throwback errors:
1 - Call to possible addFrame Script?
2 - MyClass must subclass flash.display.MovieClip etc
I've tried variations of adding and removing the flsh.display.MovieClip Class
I have a Flash project which has about 90% of its code in the first frame, on a layer called 'actions'. the remeainder of the code is attached to several buttons throughout the project. I want to take the code attached to the buttons, and paste it into the first frame, 'actions' layer. what I want to know is how to do it, and still have the buttons function properly. This is in AS2, and will eventually be converted to AS3, when I get all the working code on the first frame. I don't know how to reference it, from the first frame of 'actions' layer.
So I have been trying to figure out a way to control multiple clips using the same "on press" & "on release" statements located on 1st frame of main timeline. A variable is being set to a value that correlates to the name of each movie clip as an interaction occurs.Ex: user clicks from a selection of buttons & depending on the button clicked it sets clipNum = "1" through "21".What I want is to have something like the following code that will give the user the ability to click and drag the clip with code on the main timeline similar to the following:
p1 is the instance of the movie which I am trying to move with slider. When I apply above code on the handle of the slider with instance name 'handle' everything works perfect. Slider moves and so do the movie. Now instead when I bring the same code to the main timeline to do the same, onClipEvent does not work, it gives error. So I replaced it with the code written below. Now I can move the handle but movie is not moving.
ive made a simple game for a uni project, when you get game over a movieclip comes up and inside the movie clip there is a button to restart the game. how to i code the button inside the movieclip to gotoAndPlay to frame 1 on the main timeline?
in my main I have a system that allowed certain classes to be loaded and unloaded. When I load Game.as, it contains a trace statement when you press the left arrow key. When I remove the game instance from the stage, and set it to null, I can still press left arrow key, and the trace will come up. If I then make a new instance of game, it traces twice with only 1 click. When I close/load another time it traces three times.
I very specifically set:
Code: mainContent.removeChild(game); game = null;
Even trace statements confirmed that the game was being nullified, and the trace still continued.
I have an on enter frame listener defined in a function: Code: function sideClicked(e:MouseEvent):void { removeEventListener(Event.ENTER_FRAME, loop); var targetName=e.target.name; var a:Array=[];[Code] .....
The looptoposition() function simple calls a function from a custom class repetitively to move an object until it reaches its position. This is the function it calls from the included custom class: Code: public function rotateToPos(a:Number,b:Number,c:Number):void { if(!cubeReady){return;} if(cube.rotationY<b){ cube.rotationY+=3; [Code] .....
This gets the desired result visually - the cube rotates until the chosen point and then stops - however the listener continues. I have two problems: 1) I would like to remove the listener but can't seem to do so from the imported class - I'm having trouble referencing my functions in the root flash file. 2) I also need to declare that the function has completed - but the equalities mean that b is either greater or less than but never equal to? Whats a better way of getting the cube to rotate to a set position on each frame? The reason for the equalities are the cube can turn two different directions. So rotation could be negative.
I'm trying to get my timeline to move on to the next frame when the audio has finished playing. The audio is in the timeline. I'm new to all this so please be gentle; i am a reformed Director user.
import flash.media.SoundMixer;import flash.media.SoundChannel;import flash.media.Sound; private var channel:SoundChannel; stop();
I have a navigation bar, it has 4 buttons on it, home, about, photos, and contact. There is a movie corresponding to each button that will load a 100 frame animation. Home: home_MC, About: about_MC, etc. When the page loads, home_MC will be on the stage. I would like for the first 80 frames of home_MC to play, and then stop and wait until someone clicks one of the navigation buttons (home, about, etc..) and then continue playing. How to make a timeline based eventlistener, that when the event occurs will make the timeline (that is stopped) continue?
I cannot seem to find anything of what I need from google.(Well, I can find the reverse method to what i need ) Basically I wish to access a variable declared in the Root Timeline from my Movie clips timeline.
I simply want to assign a variable to the current frame of the main timeline (not movieclip timeline) I already know about _currentframe and it doesn't help in this case.
I am in the learning process. Working with FlashCS5 and AS3. if the issue appears to be too simple for you. Placed a movieclip(mcassessJohn) on the main timeline and moved to the frame labelled "johnFeedback" in the movieclip timeline using the following actionscript code.
I have a file comprised of 1 scene and two movie clips. The clips are instanced into the Main Timeline and occupy Frames 1 and 2 respectively.MovieClip1 is an animation that has navigation buttons that appear at the end of the clip. I'm trying to get mouse click navigation to make Frame 2 on the Main Timeline active.
Here is what I'm trying but it is not working:
btExplore.addEventListener(MouseEvent.CLICK, ExploreClick); function ExploreClick (evt:MouseEvent):void { gotoAndStop(2); }
this takes the animation to Frame 2 of the Movie Clip Timeline not Frame 2 the Main Timeline.
I'm having some problem with the workflow of flash.I make web banners everyday att my work att it is important to me to have the banners easy structured so I can copy effects, tweens and symbols to a new banner. I have Flash CS3 pro.I always start by making a symbols. And then in the symbols own timeline I make the animation or effect.
The big problem I'm having is when I have the main (scene1) timeline with many frames, and then have symbols on that timeline, with it's own timeline with some frames. The frames in the symbol timeline is okey, but at the main timeline the frames is too short or too long so the animation of the symbol cuts of early or it plays more than one time (too many frames).
How do I calculate how long a symbols timeline should be so It maches the main timeline?What happens to me is that I always have to adjust the symbols timeline and the main timeline, and this I have to do many times.
Got to the point where the hole in my AS3 knowledge is getting large!Realising I have confusion about the relationship of:Body of code on first frame of AS3 file.(Which I have so far used to create instances of library objects using addchild and make calls to class code).Is this code called the document code? What do people call it?Numerous classes linked together by extending each other etc.Library objects (usually graphical objects)Should it be done differently? have the following problems due to lack of understanding:Addchild complicated from a class but straight forward in main body code.Cant call functions on the main body code from classes, because class code does not know the main body code exists?
I have a main.fla which has 3 movieclips inside it. All 3 mc's have timelines that run 40 frames. The main.fla timeline has each mc instance on a frame. mc_1 is on frame 1 mc_2 is on frame 40 mc_3 is on frame 81 as the main timeline plays the clips each one fades to the other. I need to know how to target this scenerio after mc_3 plays I need to have a goToAndplay (20) set up so the animation inside mc_1 starts playing (frame 20) of mc_1.
I have a magic cloud effect. On frame 30 of the nested effect I would like an mc on the main timeline to become visible.Not too sure how to code with frame numbers,a) Do I put AS on the timeline of the nested clip ORb) Write code on the main timeline to listen for when the nested mc gets to frame 30
I have a movieclip on the scene. I also have a button on the scene and when I press the button I want to send a variable-value to the movieclip. I have a variable set in the actual frame on the main-timeline but the movieclip doesn't catch that, when traced I get undefined. Can I send a value from the main-timeline to a moviclips timeline?
As stupid as my question might sound, i have spent the last 2 weeks reading oop books; but could use some guidance. I have a flash project that is basically a supped up slide show. On the stage i have the following: main_mc (instance name = images_mc) = movieclip which holds "pictures" ui1 (instance name = ui1_mc) = user interface that allows user to draw on picture (when drawing is enabled) ui2 (instance name = ui2_mc) = activates invisible hit areas (buttons) on select pics, when hit area is clicked, we jump to another pic in the main_mc.
I accomplished all of this on the timeline, but am updating the code to OOP. I am having A HELL OF A TIME trying to figure out how to store references to the instances (images_mc etc..), so i can control them from varying class files. I have found it is easy to control the instances from the documentclass, but not from unrelated class files. Example: images_mc.stop(); works in document class; but ovieclip(Parent).images_mc.stop() doesn't seem to work from any class file.(ui2 class file for example);