ActionScript 1/2 :: Using Variables To Go To A Frame
Oct 12, 2011
I have two varables 'number1' and 'number2', which is set by two movie clip symbols depending on the frame they are on (eg. Frame 1 for 'object1' sets 'number1' to 1, etc.). The frame is manually selected by the user. I have a third movie symbol 'object3'. When I click a button 'enter' I want to go to the frame number of 'object3' equal to 'number1' + 'number2'.
View 1 Replies
Similar Posts:
May 16, 2009
how I access variables in a frame on the stage with code from a frame within a movieclip?(basically passing variables from a stage frame to a movieclip frame)
View 4 Replies
Apr 25, 2006
I have a submit section on my flash movie.I also have 3 frames in this movie.
Frame 1:
Yes or No radio button
Comments: text field
[code].....
View 5 Replies
Oct 22, 2010
I use flashIDE(CS5) to create and organize my assets for flash game. Some movieclips need to have specific params.I am typing them at a MC's first frame:
var shape :String= "circle";
var material :String = "wood";
And then make them Export as MovieClip.For AS3 coding I use Flash Builder 4. When I create new Instance of this MC and trace values I get "null". But if before trace gotoAndStop(1); typed then my values are ok ("wood", "circle").
View 1 Replies
Apr 1, 2010
I have a Flash project with several labeled frames. The user will be doing a lot of moving about those frames, so I wanted to simplify my navigational interface code-wise. There are six buttons, I have attached functions to them like so:
Actionscript Code:
topnavbt.addEventListener(MouseEvent.MOUSE_DOWN,lookUp);function lookUp(event:MouseEvent):void {
[code]...
...instead, I get "TypeError: Error #1034: Type Coercion failed: cannot convert "skylights" to flash.display.FrameLabel."
I can't seem to wrap my head around what these errors are saying, but I'm sure there's a simple solution I'm missing. I think I just don't know how to define the frame label correctly.
View 2 Replies
Mar 18, 2009
are all variables written as global variables in Flash CS3? Is there a way for some variables just to work for some frames?
View 2 Replies
Jul 22, 2009
How would I go about transfering variables from one from to another?
What I want to do is send data from the first frame to a database then retrieve info back and populate form field on the second frame.
At the moment I have the code within the second frame doing everything! What want is to send the username and password enter in the first frame textboxes to a database then displaying the returned info on the second frame.
View 7 Replies
Feb 18, 2010
Well, I made a login page with flash and php. So I was wondering how can I make it so that I can send variables to another frame.
Like I have a button, when you press it, it connects to the database, and it checks your login. Then it gets all the variables. So how can I get the variables for every page on my flash project?
The only way I can think of now, is setting a dynamic text to the variable..
View 3 Replies
Jun 3, 2010
how do I access the variable from another MovieClip and frame? That's about the structure of the clip:
Layer1:ActionscriptA(Frame)
Layer2: MovieClip1+
-----------------|_layer2: BoneColor(MC) +
[Code]...
I tried to do this differently, for example
var clr:BoneColor = MovieClip1.BoneColor.ActionscriptB.clr
View 3 Replies
Apr 9, 2005
How do I pass the variable from a Frame to a Movie Clip. Is there anything special?
ie,
Frame 1-2 loop
number=3
I want to pass number 3 to the movie clip what should I use if the Movie Clip is in the same frame 1-2
View 2 Replies
Jul 29, 2007
I created a slot machine and it works properly but i need it to do more. Currently when you spin the Reel, if you get any 4 of a kind its a jackpot. I need it so if you hit 4 "7's" lets say its different than hitting 4 "Bar's".On the main reel I have 4 frames with movie clips, each having a different (chip) and the end. I have set the random() function on them so it is completely random on how they hit. So my question is...how do I set a variable name for the frames so I know that frame 1 is a "bar", frame 2 is a "7", frame 3 is a "cherry" and so on. That way when I write the "if" statements, I can compare them so a "7" is better than a "bar".
View 2 Replies
Aug 4, 2003
t passing variables to another frame?
I have enterd the below code on a MC and would like the blob object in frame 2 to change the color I specified.
[AS]on (rollOver)
{
var Color1 = new Color(this);
Color1.setRGB(0x0000FF);
[Code]....
View 8 Replies
Jul 4, 2009
OK this might take a wile to explain but ill give it a go. I'm trying to make a sort f upgrade menu for my Flash game (AS2) but I'm a bit stuck. Ok my char has got this action script on it.
onClipEvent(load){
_global.speed = 1
}
onClipEvent (enterFrame) {
[Code]....
That all works fine but what i want to do is make it that when you click a button the var speed will change. I can do that quite easily with this code
on(press){
_global.speed += 1
}
and that works fine two but what i want to do is have the button for upgrading the speed on a different frame (ie. the upgrade menu)
So on frame 1 is the moving char and there is a button linking frame 1 to frame 2 (upgrade menu) and on that frame it has the button for upgrading the var speed and then a button linking frame 2 back to one but it doesn't work. I think i no why because on the char is says onClipEvent(load){ _global.speed = 1 }
so that means that the var speed will revert back to 1 when you go back to the first frame.
View 3 Replies
Oct 1, 2009
If we have declared some variables on a particular frame, say frame 20 in the actionscript coding window, can we use these variables defined on a frame in a class? Is there something like a global variable which must be declared to do this?The class extends to movieClip and it has been encapsulated by a movieClip which is then put on the stage to run it when the corresponding frame plays.
View 2 Replies
Dec 20, 2009
How can I trace a variable situated on the first frame in the scene. I mean from inside a movieclip how can i trace a variable nested in the scene? Maybe is not possible, I tried with trace(this.parent.MyVariable) but no success ...
View 3 Replies
Dec 1, 2010
I'm working on a dating sim (don't ask) and I already figured out most of the variables, but I have one problem. When the experience with one of the characters is a certain ammount, I want to play a different frame of dialouge.
Is there a way to play a new frame, only if the variable equals 10?
View 3 Replies
Jun 25, 2010
this is so complicated i don't think i'll ever be able to do it a button is clicked to start the game which is all playing in the second frame of main timeline according to the maths for as3 but i need to be able to have the same button in the same frame when clicked gotoandplay an mc which exists in frame 3
View 9 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
Jun 14, 2011
I am very new to Flash AS3 and Flash Professional CS5. What I am try to do is show frames 4 to 10 (it just say CORRECT in bold) when a user selects the correct answer.On Frame 10 I have the code say "gotoAndPlay(2);", the problem is on Frame 2 I have action-script on that page and all my variables are re-declared and they all get reset as Frame 2 is loaded.How should I prevent the variables from being reset each time frame 2 is reloaded?
View 5 Replies
Aug 18, 2009
I have 2 buttons in a flash movie with the following codes. They open a new URL that also contains a flash movie and it sends the variable "nFrame" and a value.
Button1:
Code:
on (release) {
getURL("goats.html?nFrame=1");
}
Button2:
Code:
on (release) {
getURL("goats.html?nFrame=2");
}
When the new URL opens I want the flash movie to begin at a particular frame depending on what variable "nFrame" is equal to. I tried placing this code in the first frame to do it but it didn't work, the movie just loops and loops and doesn't stop at any frame.
Code:
if(nFrame=1) {
gotoAndStop("cheese");
} else {
gotoAndStop("wine");}
}
View 1 Replies
Sep 16, 2010
In my flash program I have everything on one frame. In the actionscript on that frame, I made a variable called currentButton and set it to the first button, to keep track of which button is currently pressed. In the click function this variable is changed to whatever button was clicked.Now, I didn't think this would work, because seeing that the one frame is being played over and over, (there's no stop() command in there) I thought currentButton would keep being reset every frame. To my surprise, it worked just fine. Not that I'm complaining, but I'd like to know why it's doing that. Shouldn't all the code on the frame be done every time the frame is played, including the part that sets currentButton to button1?
View 4 Replies
Apr 7, 2011
I am trying to create an AS3 Fla to score a quiz's results. The quiz is a separate swf that stores its results to a shared object ("G1"), and both the quiz swf and this new scoring swf would reside on the same website.
I've tried scripting the AS3 in the new scoring Fla but I keep getting error messages.
So far, here's what I have that doesn't work.
[Code]....
The goal is to open the scoring swf, populate some variables with the values from the SO, then (not yet tried in the script) apply some if/else conditions to show specific results based on scores.
View 3 Replies
Jun 28, 2011
I have written some code to read and compare variables and then to jump to a particular frame based on the results (pretty simple stuff). It works fine when I use a button to trigger the code but I want it to happen automatically.
I have tried using the OnEnterFrame thingy but it doesn't work and I tried just placing the code on frame 1 and letting it do its thang but that didn't work either....
I'm using the .swf in a third party program and using the API for that program to supply the values.
here is the code:
_parent.InitializeExternalVars();
var m_varStrEndSlide;
function display(){
[Code]....
View 0 Replies
Nov 21, 2007
I have my flash on multiple scenes, and would like to play an animation when clicking on the navigation button before switching to a different scene.
I'm halfway to accomplishing this.
Here is what i used
Code:
_root.gotoAndPlay("changepage1");
_root.onEnterFrame=function(){
if(this._currentframe=="changepage2"){
[Code]....
The above code is on a blank keyframe. Changepage1 is the start of the animation and Changepage2 is the end of the animation.
Upon clicking the navigation button it plays the above scenes.
However it doesn't change scenes to scene "Home2".
View 1 Replies
Mar 4, 2009
What command do I enter for the movie to rewind to first frame on entering a certain frame / stopping in a frame?It's my first time using Flash, and I'm working on a double menu (second menu has a "close" button, where I want to get back to the first menu).
View 5 Replies
Mar 21, 2012
I have an empty SWF that's sole purpose is to call loadMovieNum and start the project. Each loaded movie has a few variables defined within them - unique to those loaded SWFs. Instead of declaring all the variables in each SWF can I declare all of them in one place, in the first frame of the empty loader it all starts from? I'm thinking I can then declare a variable which each loaded movie can increment as needed for me.
View 2 Replies
Aug 20, 2008
How do variables true/false custom variables work in flash?
For example, what I want to do is create a simple true=false variable that I can call on an if statement later.
For example:
Code:
Var1 = true;
if (!Var1)
{
[Code]....
I noticed that neither the "Var1 = true;" part or the if(!Var1) part worked in flash.
View 4 Replies
Feb 21, 2009
How can I make a bunch of variables from a for loop. for example for (var i=0; i<total; i++) {var bunch(i);}. that i make a bunch of variables named bunch1, bunch2, bunch3. I keep getting errors. I program and use so many different languages that I dont know if that can be done with AS3. my only other alternative i can think of is to create some sort of event dispatcher object array. but I dont know how to get them all to send events to one listener with there index number.
View 5 Replies
Jul 30, 2010
I have a list of strings that I add to an array, then attempt to set those values in a for-loop using data that I read in. The array gets updated, but the values the array contains do not. I also have an array of buttons that I update this same way that works great, but strings don't seem to work the same way. I have tried moving the string array to give it full scope, and still nothing...
public class test extends Sprite
{
// Declare a list of strings
protected var title0:String = undefined;
[Code]....
View 1 Replies
Jun 15, 2010
I'm writing code that takes data from mysql that's processed by a PHP script. It's actually a bit bizarre, at least to me. Anyway, here's some basic AS3 code that's moving toward what I want to do:
var loader:URLLoader = new URLLoader();
var urlRequest:URLRequest=new URLRequest("receive.php");
urlRequest.method=URLRequestMethod.GET;[code]....
For some reason, the statement "trace(evt.target.data);" produces a whole pile of garbled text before the actual stuff that it's supposed to show Because of problem #1, I've had to include a throwaway variable at the beginning, otherwise the first variable I try to pass into AS3 comes back as undefined. This causes errors when I run my flash movie in the IDE, but when I run it from the browser it doesn't seem to have any effect.But this is the strangest thing of all whenever I make any changes to the database (and subsequently try to load data from different variables), the new variables come back as undefined. For example, let's say that I add another entry to the database, and decide to load students 2, 3, and 4 instead of 1, 2, and 3. When I do that, any new data I've added comes back as undefined, even though when I view the PHP output in my browser, it looks just fine.
And now for the REALLY bizarre part: I'll copy that output, paste it into my PHP script as an echo statement, comment everything else out, and my flash movie runs fine. Even though the output from the PHP script is exactly the same, it gives me errors.
View 9 Replies