Actionscript 3.0 :: GotoAndStop() For Only One Instance
Mar 9, 2009
Is it possible to let an instance gotoAndStop("some frame"), and leave others on the previous frame?
Since I did some research of that function, and it is always used like this:
Code: Select allgotoAndStop("some frame");
and I haven't seen anyone use it like this:
Code: Select allmyInstance.gotoAndStop("some frame");
View 2 Replies
Similar Posts:
Aug 13, 2011
i have never actually got the flash-actionscript code execution order.in flash pro i have an instance of a moveiclip on stage in frame one named tree1 and on frame 3 i have on the stage tree3.in the document class i have this code:
stop();
var scaleFactor:Number = tree1.scaleX;
gotoAndStop(3);
tree3.scaleX = scaleFactor;
while this works when testing on the desktop, this app will go mobile at the end.is this the correct way to go or should i register for a frameComplete event before accessing instances on a certain frame
View 1 Replies
Feb 8, 2007
I have a movie clip on the stage and have given it the instance name "team1". inside this movie clip there are two states. at frame1 it says one thing, then at frame 10 has an image. team1 stops at frame 1 and what i want to do is when the main time line reaches say frame 50, i want the team1 movie clip to gotoAndStop at frame 10, thus showing the image and not the text. i tried doing it by putting this on the main timeline at frame 50: team1.gotoAndStop("team");
View 2 Replies
Mar 20, 2009
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?
View 1 Replies
Jun 17, 2010
I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?
package
{
import flash.display.MovieClip;[code].....
The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.
View 1 Replies
Dec 2, 2010
I have a BUNCH of bumpers of four types bounceUp, bounceDown, bounceLeft, bounceRight. during a collision which you hit determines the bounce so they always do the same thing so here's my question.....can i just name every bounceUp instance the same thing and then just add that one instance name to the list the collision detector checks?
i just dont wanna go through and name a hundred each of bounceUp s and bounceDown s individually as the potential for screaming increases proportionally.......
View 5 Replies
Apr 16, 2011
I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:
function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);
[code].....
View 2 Replies
Jul 19, 2004
Does anyone know if it is possinle to scroll a graphic or a movie instance as well as a text instance in flash. I want to scroll text and images as well. Actually text with imges embedded in it.
View 3 Replies
Mar 14, 2006
I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:
1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.
2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.
It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:
[Code]....
View 4 Replies
Jan 26, 2009
I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:
[Code]...
Does one way free up more memory or enhance performance?
View 5 Replies
Feb 12, 2012
I have a base class I've used on 6 different MC's. Then when I use these MC's my function runs an if statement to check which one to add.
if(id=design) var obj = new design();
if(id=team) var obj = new team();
I want to make it a bit more dynamic and use the id:String to evaluate which new instance to create.
ActionScript Code:
public function loadChapter(id:String):void {
var obj = new instance_of( id )();
}
View 5 Replies
Nov 4, 2009
How to set gotoAndStop on 10 frame of my main stage ?
View 5 Replies
Jul 17, 2008
I have a mc that I use as a stop/play button for music. One the main stage there are 3 of these buttons for 3 different songs. One frame one of each MC there is a triangle for play with this code:
stop();
btn_play.onRelease = function (){
stopAllSounds();
gotoAndPlay(2);
}
Then on frame 2 there is a square for stop with this code:
stop();
btn_stop.onRelease = function (){
gotoAndStop(1);
stopAllSounds();
}
It works fine as far as stopping and playing. The stopAllSounds is to prevent the music from overlapping in case the user didn't press stop before playing a different song.If the user presses play to hear a song then wants to hear another song so he decides to click play on a different song without first clicking the stop button there a problem.The problem is that he is still stopped on frame 2 of the first song therefor the square is still visible. In this case in order to hear the first song again he would have to double click.
Is there any way, from the main timeline, I can tell it onRelease of a specific button within a specific buttion to make a different mc to got frame 1?
View 1 Replies
Jun 8, 2009
I've got a strange thing in attached fla: my gotoAndStop command won't go past a photo?First I've got the 'background' layer. On it is a red rectangle on frame 1 and 2. Frame 3 changes it into a jpg.
On the actions layer I've got a gotoAndStop(4), which should show the photo and trace a command. But it won't get past the red square? It's like the jpg photo blocks the gotoandStop(or Play for that matter) command. It doesn't trace to prove that the gotoAndStop command is executed on frame 4 and it keeps showing the red square on frame 1 and 2. Where it should show the photo which has already been placed on frame 3. when I replace the photo with a normal Flash shape (rectangle e.g.) it works fine.
View 2 Replies
Aug 29, 2009
Well basically I've got this one frame in my animation. It's got three buttons and an input text box. One of the buttons goes with the text box, but I want the enter key to do the same thing (gotoAndStop) as the button. Unfortunately I've not a clue how.
View 2 Replies
May 15, 2010
I'm creating an input that can have multiple passwords,you type in a pass, and depending on the pass it brings you to a certain frame.
Actionscript Code:
stop();trigger.onRelease = function() { if ( input = "1234" ) { gotoAndStop(2); if ( input = "1111" ) { gotoAndStop(3); }}
[code]....
View 5 Replies
Mar 31, 2011
im very new to AS3 and im not sure what i am doing wrong. i have a made adrag and drop situation where someone is cooking a steak. the pan has the instance name of triangle_mc and and the food has an instance name of triangle_mc the script below works fine.
[CODE]....
View 2 Replies
Apr 2, 2009
But I have ran into another snag. This is what I currently have: A MovieClip for the quiz. 10 more MovieClips one for each question. 2 buttons inside question (btnCheck and btnNext). 4 radio buttons to select then click btnCheck to check the answer. Then click btn Next to move to the next question. The functions inside the movie clips are setting the variables outside the question clips perfectly. What I want to do is to eliminate the btnCheck and have it check the answer when the radio button group is selected.
[Code]...
View 1 Replies
Oct 1, 2008
I cant seem to get gotoAndStop to work on an externally loaded swf. My external SWF has five keyframes on the main timeline. I am able to load it in fine, but as soon as I create a function to move to a different keyframe it wont work. I have tried everything, but nothing is working. Here is my attached code.
View 9 Replies
Oct 29, 2010
I was making a game and i made a back button so when you click it you go to frame 3.OK so i tested it out and when i clicked it my people and my tiles and everything was still there.
View 6 Replies
Apr 14, 2011
NumberDots();
var myvar
function NumberDots():void
[code]....
View 3 Replies
Jul 2, 2011
I've recently started using AS3 in flash and it's giving me some troubles. Here's the situation:On my first frame on the main timeline I use a gotoAndStop("home") command to go to my homepage which is on frame 45 and labeled "home".
From frame 2 up to frame 44 there are multiple movieclips with animations and sound in them, which stop at frame 45. When I use the gotoAndStop() command in my first frame it seems to work but the sounds of my movieclips in the previous frames keep looping. I don't understand why this is happening, since my movieclips aren't even on frame 45.
[Code]...
View 4 Replies
Aug 5, 2009
I'm currently receiving two variables from PHP, both containing two different numbers. These numbers reflect what frame i should gotoAndStop in two different movieclips. My problem is, that my second gotoAndStop won't use my second variable. The first variable will gotoAndStop as its supposed too.
[Code]....
View 2 Replies
Aug 31, 2009
I was wondering if you might have some insight as to why my code is not working.I have attached the file
using flash lite 2.0
using action script 2.0 /1.0
use the emulator flash mobile using the key board arrow left and right select Tetris frame("Tetris")and press enter after that click on the soft key it should go back to frame one but it doesnt
View 0 Replies
Sep 17, 2009
Had the MC set as a graphic... rookie error.
View 0 Replies
Jan 3, 2010
I want to make the player execute the code in the same frame. If I do a gotoAndStop to the same frame number, nothing happens because AS3 assumes since that you're already there, so nothing happens.
View 3 Replies
Mar 2, 2012
I am just curious to whether it is possible to gotoAndStop on a frame and hold for let's say 3 seconds?
View 1 Replies
Feb 4, 2005
I have 2 keyframes, both containing buttons and then i load a variable from another ocument, "messages.txt". This document only contains one line atm, which is:messages=1When messages are more then 0, i want to go to my second keyframe.This is the code I'm using in keyframe 1:
stop();
loadText = new LoadVars();
loadText.load("messages.txt");
[code].....
View 3 Replies
May 3, 2005
I want to be able to do something like this:
Code:
gotoAndStop(("level"+x),1);
Where x is a number variable and there are the scenes "level1", "level2", "leve3l", etc. I tried this and a few other things but none of them worked. Is this even possible or is the scene field in gotoAndStop that limited?
View 2 Replies
Jun 12, 2009
how do you use the gotoAndStop after a tween has run?
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[Code]....
View 2 Replies