ActionScript 2.0 :: Referencing Frame Label Children?
Jul 24, 2011
I have this issue with action script I've written (AS2), it is simple movement code for an on-screen character.
I have a character set up with a hierarchy of nested movie clips and frame labels.
Main character MC (1 frame, no label)
|
Front/Side/Back pose MCs (several separate frames, with labels, no animations)
|
Animation MCs for single pose (e.g. idle, walk, crouch, etc) (several separate frames, with labels)
I want to reference the child frame labels with gotoAndStop ('Front.walk'), or similar...
Here is the code I have now:
keyListener = new Object();
keyListener.onKeyDown = function ()
{
[Code]....
The problem is, as soon as the character moves one direction and changes to the desired pose, when I try to go the opposite direction... the pose doesn't change to the opposite direction frame label. So it only works once, and stays on that child frame label.
Is there a problem with the way I'm referencing the child frame labels?
View 2 Replies
Similar Posts:
Sep 30, 2009
How do I reference the root frame label in a function for event dispatching using a switch statement.
SUMMARY: This is simple, but as I've stepped away from ActionScript for too long, I'm having trouble figuring out the proper test expression to reference the root timeline frame label (e.g., switch(the root frame label)).
Nothing i've tried works:
switch(this.label)://obviously this would look at the button timeline switch(event.root.label)://player says there is no "root" property ...
STRUCTURE: I have five MCs, one on each of five frames. I have a forward button and a back button. I created a switch statement to specify different actions, based on the root frame label. Frame labels are f1, f2, f3, f4, fend.
THE RELEVANT CODE on Frame one ("f1"):
Code:
stop();
nexter.addEventListener(MouseEvent.CLICK, onNexter);
nexter.buttonMode = true;
[Code]...
View 3 Replies
Oct 31, 2010
just thinking out the setup of a sidescroll/platformer..i want the player not to fall through the floor or go through walls i know how to hittest with a single object, but what i have is various objects that extend the class wall. if I hittest with wall will that also apply to the serrated_floor and portcullis classes that extend wall?
View 1 Replies
Feb 29, 2012
Is it possible to change a frame label within a gotoAndStop('label') with the parameters in a function?I'm playing around with updating code as I learn more and more techniques, and at the moment the code is a basic click-a-button to select the object shape, and on press the button disappears:
// Change the object into a circle.
circle_btn.addEventListener(MouseEvent.CLICK,function(){changeShape_fun(circle_btn,circle);});
// Change the object into a square.
square_btn.addEventListener(MouseEvent.CLICK,function(){changeShape_fun(square_btn,square);});
[code]....
However I can't/don't seem to know how to change a frame label through function parameters, or if what I'm trying to do is even possible.Also to note, while I'm all ears for any more efficient ways of doing what I'm trying to do, I would still like to know how/if you can change frame labels through function parmeters.
View 1 Replies
Aug 25, 2008
I'm new with Actionscript and am currently working atbuilding a website. I've got a lot figured out so far but oneproblem I'm running into is when I try to load an external .swfusing the loader component and then reference it or try to point toit within my main .swf I can only load the "gallery.swf." throughmyLoader.contentPath = "gallery.swf";I'm trying to load it and then point to a specific label soit loads that frame or label. I've created separate labels for eachimage in my gallery so that when I point to them with AS, it knowswhich image to load. It worked when I had the gallery in the main.swf but when I used the loader component it didn't work.The AS I used that worked before I made a separate .swf andused a loader was:
on(release) {
_parent._parent._parent.photos_MC.gotoAndPlay("img1");
}
[code]....
View 1 Replies
Jun 11, 2006
is there an action script code that enables the timeline to automatically enter a frame label on entering a certain frame.
View 1 Replies
Aug 30, 2007
I'm trying to get this function to target myClip_mc and movethe frame head to another frame label.
var counter:Number = 1;
//textBeGone
invisible_btn.onRelease = function(){
counter++;
if(counter % 2 = true) {
[code].....
View 2 Replies
Mar 11, 2011
is it possible automatically name frame label with instance name of item in frame.
View 2 Replies
Nov 6, 2006
1. I make a simple movie (call it movieClip) first frame has stop(); action, second frame has label playMovie, last frame has action gotoAndPlay(2); (so that movie not stop anymore2. Now I place movieClip on stage3. Question... what is code to make movieClip play frame label playMovie?
I already try to put many different type action in frame one of stage
this.movieClip.gotoAndPlay("2"); //NOT WORK
this.movieClip.gotoAndPlay(2); //NOT WORK
[code].....
View 7 Replies
Jun 5, 2009
Yesterday Kglad gave me the following :
nextTX.onRelease = function (){var nextFrameLabelNum:Number = (1+Math.round(thTX._currentframe/27))%10;
thTX.gotoAndPlay("next "+nextFrameLabelNum);
}[code].....
which works great IF I am moving one image at a time.What I have done now is tween 3 slides to move into a visible mask by pressing next, but when I press previous of course the above doesn't work.It just jumps to the previous three with no tween.I would like to maintain the tween but in reverse.I would like the previous just to undo, in reverse, what the next button just did with the tween?Is there anyway to make this happen with as 2.0?
View 1 Replies
Aug 6, 2009
if its possible, via AS3, to create a frame label in a movieclip on a specific frame.
Obviously I can do it by manually by setting up labels on the timeline within the target movieclip, but I would rather use an array so I can loop through it, creating a label name on a the specific frame each time?
so for example I would end up with:
myLabelOne on frame 10
myLabelTwo on frame 25
myLabelThree on frame 115
etc
View 3 Replies
Jun 30, 2004
I am trying to use this if statement with a frame label instead of a frame number. I believe that _currentframe is looking for a number only. Is there a different command that looks at frame labels instead of frame numbers?
View 1 Replies
Jun 20, 2007
is it possible to find the frame number of frame label with AS if a button is rolled over, the timeline jumps to a label - which plays a set of 3D rendered frames to 'raise' and element, once a user rolls out of the 'button' area the button is meant to 'lower' - which can be done by simply playing backwards to the previous label.
View 5 Replies
Jun 30, 2004
I am trying to use this if statement with a frame label instead of a frame number. I believe that _currentframe is looking for a number only. Is there a different command that looks at frame labels instead of frame numbers?
View 1 Replies
Jan 31, 2011
Is there a simple way to get the frame number of a frame label?
View 2 Replies
Nov 1, 2004
I am loading a swf into an empty MC with this code:
on(release) {
loadMovie("movie.swf", _root.container);
}
what I want to do is also go to a specific frame or frame label in that loaded movie. I thought I could do it by adding something like this:
_root.containter.gotoAndPlay("frame");
View 9 Replies
Jun 3, 2011
Is there a way to get the frame label on a specific frame, without it being the current frame?
I've tried accessing it through:
this.scenes[0].labels but it doesn't allow me to check a specific point on the timeline.
View 2 Replies
May 7, 2009
I have an object present in frame 3 of the main timeline. When the object was present in frame 1 i could access it from an as3 code file. But when I am keeping the object in frame 3 of the timeline (Please note that the previous frames for that layer is blank). I am getting a null value for the object. if I try to use trace the object.Logically if I am in frame 3 i should be able to access it.
View 3 Replies
Dec 14, 2009
Trying to go to a frame label - 1 frame -
[Code]...
View 6 Replies
Dec 27, 2003
Does anyone know why if I use
on (press) {
_parent._parent.gotoAndPlay(19);
}[code]....
it will work? My labeled frame is two parent mc's previous and it doesnt work when I call to it with the label?I would really like to use the label so if I move my keyframes around I dont have to change a lot of code.....
View 8 Replies
Nov 20, 2009
I have a frame that I want to display but the function that calls it exists on the parentHow do I call a frame that exists within a child movieclip from its parent?Here is my code. It is basically for a restart button.Here is the parent function.
Code:
function restart(event:Event)
{
[code].....
View 3 Replies
Dec 1, 2010
If I have a movie clip with named frames, can I reference the frame names in an if-else statement? For instance,
if (frame name = "frame1")
gotoAndStop.frame2;
etc. Is that doable?
View 5 Replies
Nov 18, 2009
I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)
Code:
<root>
<dir name="images">
[code]....
View 2 Replies
Oct 10, 2009
I have three buttons, btn_1,btn_2,btn_3, and two movie clips, image_1,image_2. The names listed btn_1,btn_2,btn_3, image_1,image_2. are all instance names. All buttons and movie clips are on their own layer in a single frame on the main time line. the movie clips have a stop action on the first and last frame, with a frame label, on the first frame in the sub time line. For image_1 the frame label is image_1_1 and for image_2 the frame label is image_2_1.
I would like btn_1 and btn_2 to control the movie clips, image_1,image_2. Either button should be able to close the other buttons movie clip and play it's own movie clip. Also i am trying to make the movie clips themselves have the ability to be closed by clicking on the movie clip image area that is playing. Both movie clips when not playing hide behind the appropriate button with an alfa of 0.
When playing they expand to the middle of the window and are at 100% alfa, using a tween. The third button, btn_3 should only be visible when one or the other movie clisp are playing. btn_3 dose nothing else but this for now. As of now, my movies continuously loop and btn_3 is always visible. I can't seem to figure this out. my code for this action is:
[Code]...
View 1 Replies
Mar 18, 2010
I am creating a breakout game and below is a part of my code:
function updateGame(e:Event) {
if (ball_mc.hitTestObject(brickone_mc)) {
beepSound.play();
yVel*=-1;
removeChild(brickone_mc);
[Code]...
I have got it removing the bricks as each brick has an instance name, I am now wanting to go to an end screen once all the bricks have been removed, is there a way to count the children and then put a gotoAndStop() in?
View 1 Replies
Apr 20, 2010
I'm working with a movieclip right now that has two frames in it. I want the user to be able to go back and forth between the pages by clicking on tabs on either page. The button that they click on is only present on the frame that it is applicable (so, the button to switch to frame 2 is only present on frame 1, and vice versa).
I want to control when they are able to click back and forth, and be able to turn the buttons on and off whenever I need to, but since the button to switch back to frame 1 is only on frame 2, when I reference it from the main timeline, the button registers as a null object. How do I refrence an object that is not present on the first frame of a clip?
[Code]....
View 3 Replies
Oct 27, 2009
Got some external classes, say MyClass.as MyClass.as has a static variable called foo
So, ordinarily in other AS files I can call this with MyClass.foo = bar;
However, this seems to be different in timeline scripts. Every time I try this I get the reference with a static type error 1119: Access of possibly undefined property foo through a reference with static type flash.display:DisplayObjectContainer.
I've tried doing an import MyClass, etc... nothing seems to be firing.
View 1 Replies
Apr 7, 2009
I have navigation buttons that are linked to frame labels on other scenes and when you double click them they go to the next scene.
For example if i was to click the home button twice it would go to the info scene and if i click it a third time it will go to another scene.
This is the actionscript im using:
What do i need to add or do to fix this
View 3 Replies
Aug 31, 2009
I have a tic-tac-toe game. Where the user would which spot they would want to put their X or O in and then they would go to a random question. That's where my problem starts. How do I get it to go to a random question?[code]This is what I tried using. It works, but it only goes to QuestionOne. I tried putting a comma to seperate the labels, but that just makes it play the whole movie.
View 2 Replies
Mar 24, 2010
Following the common rules, I'd like to put all my as2 code in the first frame of a layer named "code". Then this question occurred: how to implement that "taking some actions when a specified frame(best using "frame label" not "frame index number") entered" in the "code frame" using as2. what i can call to mind is listen the enter frame message of the current MC, but how can i check if the current entered frame is the specified frame?
View 7 Replies