Actionscript :: Symbol To Reference Button Instance On Main Timeline?
Sep 30, 2009
How would I reference a button instance on the main timeline in the actionscript within a movie clip symbol?For example: btn1.addEventListener (MouseEvent.ROLL_OVER, main1Over);where btn1 is an instance of a button on the main timeline but is not found within the symbol itself.I will then be dragging that movie clip onto the main timeline when it's finished.
So I have a button on which I create an instance of a symbol, I'd like to have a listener for the new symbol but I get a reference error because it compiles the listener before I get to create the instance. What do I do?
I've been trying to reference a Library symbol that is introduced in Frame 2 by using it's instance name, using timeline scripting only. I am trying to make a colour picker MC symbol for multiple re-use. Firstly I drew a small button on the stage and converted to MC, called textColourPicker of type CPicker (the class used to represent this MC in the Library). Inside this MC I have a button symbol called pickerButton
1. When I make a symbol, I find the reference point always appear on the upper left corner, is there a way I can change the position of that?(besides use javascript?)
2. When I make a animated graphic Symbol, I drag into scene, it always repeat itself so I have to change the instance property to non-loop. Is there a preference which I can preset all the instance to non-loop?
3. if I make 2 animation character in 2 different flash file, how can I combine the 2 files but still keep the layer and key for each character?
I've created a movie clip symbol with it's own animation on its timeline. I've placed this symbol onto the first frame of the main timeline but when I test it, it doesn't play. There's no stop actions or anything on either timelines so I'm not sure why this is happening. I thought that the animation in a movie clip symbol will automatically play (i.e. if you test in a browser) once it's on the main timeline - is this right? Or am I doing something wrong. Maybe I need to tell it to play?
i am creating a survey with say 7 questions. each question has the same MovieClip symbol each with a different instance name, like q1, q2, ... q7.
the MovieClip symbol has 5 static texts and 5 SimpleButtons. i have some code in that symbol to make sure that only a single button has the "on" or "checked" state to show that that one is chosen. this works great.
my question is, how do i communicate each user choice with the main timeline after the user hits the "submit" button? or, how do i have code under the "submit" mousedown event that can iterate through the 7 symbols to query each one and see which of the 5 SimpleButtons is "checked" or "on". this iteration will then create a list of responses for all 7 questions.
ultimately, i will have flash concatenate a GET POST string that will send the survey results to a web server.
Does anyone know a good way to acquire the currentFrame of a movieclip symbol placed on the main timeline? currently there is only 1 frame, but the movieclip has 50.
If i trace currentFrame, i only get 1. and tracing the child name doesnt work either.
I got it to work earlier but it crashed before i got to save and now i cant figure it out. Was something to do with making another movieclip symbol.
What I have is a situation where I need to play some frames on the main timeline, say to frame 5. I place a movie clip symbol in frame 5 which I want to play (all is working fine so far).Once the Movie clip is finished playing, I want the main timeline to start again.In AS2, I would simply put
_root.play();
Now in AS3, I think it should read
root.play();
but I get an error which reads:call to a possibly undefined method play through a reference with static type flash.displayisplayObject
I have spent many frustrating hours trying to figure out why this is happening. It is totally broken. I need to use a motion path using 3d in a symbol. Because of the way the project is put together (for Flex) there are several FLAs that need to be converted to symbols.
So when I convert the FLA that contains a motion path with 3D, the object moves away from the path in the symbol (the 1st frame remains in place, but everything else is off the path), even though it remains correct in the main timeline.
And once I start editing the object in the symbol, the object returns to the path ok, as if it had been some strange display issue, but the 3D is all wrong - the vanishing point relative to the object has changed. The same thing happens whether I create the 3D path using "global" or "local" tool settings.
I am positioning a movie clip within a movieclip, so obviously when I say for example: ActionScript Code: photo_mc.picture.x = 0; photo_mc.picture.y = 0; It positions the picture movie clip with in the reference of the photo_mc clip, and not the main stage. How can I reference it to the main stage (0,0)? - because the photo_mc moves around randomly, so to compensate would be pointless!
I have a simple problem that I've been working on for hours, trying to go through trial and error myself. But here's the problem. I have a function on the main timeline named startClips. Now, I want to call this from from within two movie clips, the other nested inside the other. In other words, I have a movie clip called holder, and inside of a holder, I have a movieclip called homebase. Now, here is all the code I've been trying to use to access the startClips function which is own the main timeline from the movieclip homebase:
I'm having to convert an AS2 app to AS3. In the AS2 app I have nested MovieClip in which is a reference to the main timeline (sloppy practice, I know, and now I'm paying for it).
if(_root._currentframe == 3){ ...
which threw an error. I changed it to
if(stage._currentframe == 3){ ...
but it's still throwing an error. The same thing happens when I try to reference a variable defined on the main timeline...
var inPlay:Boolean; //on frame 1 of the main timeline if(stage.inPlay){ ... // on a frame in a nested clip. This also throws an error.
this is one of those upsurdly basic questions for which google does not work. I have usually dispatched events from my classes and dealt with the user interface in the document class. But now i want to separate all the UI in a separate class, accessible by other classes. have added it as a child to the main/document class, but how do i reference the main class without going through parent.parent shananigans?dit. one more thing i remembered. Some of my UI elements are not programatically added.here is the code i have. i get possibly undefined property error.
im trying to tell my main movie to goto a certain movieclip in the timeline from my loaded external swf heres the code Im working with,[code]I can tell the script is executing because the external movieclip unloads itself but the main movie does nothing.
Is there a way to get an instance reference to the document class to call a method of it from the stage's timeline?I see that here's a possible solution: using a singletonOther solution I though of is using stage.getChildAt( 0 ) but it's not very nice.Is there an 'official' instance reference? because the document class is obviously instantiated at startup, but is that instance accessible in any way without having to use a custom solution like the ones mentioned?
I have a function on the main timeline named startClips. Now, I want to call this from within two movie clips, the other nested inside the other. In other words, I have a movie clip called holder, and inside of a holder, I have a movieclip called homebase. Now, here is all the code I've been trying to use to access the startClips function which is own the main timeline from the movieclip homebase:
I've been programming with AS2 for a few years and I just made the switch to AS3. I'm hoping there is an easy solution to this problem. I have a class 'Actor' (extends MovieClip) that needs to hitTestPoint on a nested MovieClip 'root.World.walls' in a function moveRight(). The line of code looks like this: ...while (MovieClip(root).World.walls.hitTestPoint(pnt.x, pnt.y, true)) {... But I keep getting various errors when I try different solutions.
I`m experiencing problems with an XML menu. It works fine, but when I try to insert it into a mc other than the main timeline it stops working. I believe that I have trouble with the names of the mc (or instance name). could the "menu" in this string be a signifier for an instance (mc) ??
I created a button (button symbol), inside this button symbol there is a vector shape which will change colours in mouse over and a dynamic text field. i want to use this button symbol in more than one locations in my stage. so i need to change the label of these instances (by changing dynamic text ). but i can't access the dynamic text in as3 using following code,
btnsample.txtbtnlabel.text = "button label"
this code is working fine for a movie clip symbol but not for a button symbol.
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.
this may be a basic thing, but i couldn't find an answer by serching internet. I have created a simple button - Istance name = "btnsample"and there are two layers layer 0- button design with rollovers - layer 1- dynamic text field - instance name = "txtbtnlabel"btnsample.txtbtnlabel.text = "new button label;but it's giving followin error :-119:Access of possible undefined propety txtbtnlabel through a reference with static type flash.display:simpleButton.
How do I link a button thats embedded in frame 2 (music page timeline) to a frame in the main timeline ( frame 3= biography page)? Both pages are on the same scene with link buttons embedded in each page independent timeline.
I have a project in Flash Professional CS5 and ActionScript 3.
I have a movieclip symbol (referred herein as "background" with scripts on various keyframes inside of that symbol. I need to hide or show another symbol (referred herein as "object") sharing a stage with "background".
To put it another way, I need "object" to be hidden when "background" reaches a certain internal keyframe. However, as "object" and "background" are both children of the same stage, how do I do this?
I have a mc (instance name "button_mc" on main timeline which has other mc buttons on the 10th frame of its ("button_mc") timeline.All my actions are on the top layer of the maintimeline
I am just about to give up on this whole as3 thing altogether. It is so complex that it is becoming prohibitive for designers, event technical ones ike me (I program easily in perl/php/javascript/sql). All I am trying to do start the main timeline from a button. The button's "up" state is also a movie clip.
Here's the process I am looking for:
1) the main timeline progresses until a certain point where I have inserted a stop();
2) I then display a "continue" button (which is an animated movie clip).
3) the user will "click" the button and the main timeline continues.
My simple Code:
this.stop(); function closeIt(event:MouseEvent):void {
[code]....
My problem: when the button is clicked it just starts the button over again.
I have a movie Clip on my main timeline and with in that movie clip is a button. That button has a CLICK event that I want o go back and refer to a "frame" on the main time line. How would I go about doing that?
Here is what I thought I should do
import flash.events.MouseEvent;
WebSitesBtn.addEventListener(MouseEvent.CLICK,WebDesignBtnClick); function WebDesignBtnClick(event:MouseEvent):void{ _parent:gotoAndStop("Web Design"); }
"Web Design" is the Frame Label which I want to refer too
what I am missing or how I can properly refer to the main time line?