ActionScript 2.0 :: Checking Multiple Variables Through MovieClips
Aug 22, 2010
I am trying to check through all of my movie clips to see if any of them are on frame 15 so that I can play them. This is my current code
Code:
anybtn = [btn1_mc, btn2_mc];
btn1.onPress = function(){
if(anybtn[0, 1]._currentframe == 15){
trace ("MC check is working.");
anybtn.play();
[Code] .....
I would also like to figure out a way for the button i click to wait to play the movie clip after the anybtn movie clip is finished playing. Overall I am trying to achieve a menu that works similar to this [URL]. So that it will finish playing the first clip before loading the next.
View 4 Replies
Similar Posts:
May 26, 2005
Basically I just wondered if there was any way to condense this so I don't have to keep repeating the code over and over for all of the movieclips:
[AS]onClipEvent (enterFrame) {
var colorChanger:Color = new Color(this._parent.leaf8);
var origTransform:Object = colorChanger.getTransform();
[code].....
View 14 Replies
Oct 20, 2010
why this code works on my other flash file and it doesnt on the new one. This is the code:
if (test == "PRIZE1"){
trace ("prizes/prize1.jpg");
}
[Code].....
Basically it should check whther the variable has any of the above words loaded on it dynamically so that it loads a movie that corresponds to it. I put the trace on the above so I can track whther it was reading or not. Obviously it wasnt. My publish settings are Flash Player 8 with Actionscript 2.0
View 4 Replies
Feb 5, 2010
Each button has 3 different animations on the same timeline: one for when you mouseover, one for when you mouseout, and one for when you click. Each animation ends with a 'stop();" command, obviously. However, when someone mouses over, then out of a button quickly, it interrupts the "over" animation and begins the "out" one, which looks choppy and awful. I need a way that when I mouseover a movie clip, a variable within said clip changes to 0, and when I mouseout, it changes to 1.
The big problem comes with the fact that I have multiple buttons with listeners, all of which use the same generic function to respond to mouseover/mouseout events. Is there a way to set up a variable associated with each button, then call the specific variable within the generic function?
ActionScript Code:
button1.outcheck = 0;
button2.outcheck = 0;
button3.outcheck = 0;
[code]....
Is there a viable solution, or will I have to just rethink the entire animation?
View 3 Replies
Oct 6, 2011
I just want to know if there is a way to assign multiple variables, and if there is a way to check multiple variables.
I want to be able to assign variables to false and then check if all the variables are false.
View 1 Replies
Sep 20, 2010
I've just been searching the internet for some code to check several variables in one big If Statement, I just wanted to double check here whether the code I found is correct! Is it right to type it like this?
[CODE].....
View 2 Replies
Jun 14, 2005
how I could somehow create an "if then" statement with variables for my website.
Basically I just want to have a button that checks for a certain variable when you click it (I want it to check if a movie, lets call it "movie1" is already loaded). If it comes back false, then movie1 and movie2 both get loaded.
This way, after movie1 is loaded for the first time, it wont be loaded again. Basically, movie1 is just my background for all my other movies. So clicking button1 for the first time would load movie1 and movie2. Clicking button2 AFTER button1 was clicked would only load movie3.
View 1 Replies
Sep 16, 2005
I'm having the hardest time getting this to work, I have the concept of how things need to be put together, but the code is wrong. I can't even get the first if statement to work.I have a menu that is going to be loading external swfs into an empty mc. It needs to check to make sure the external swf has gone through its stopping animation before loading something else. Here's what I've got so far... I hope this is clear enough...button:
Code:
on (press) {
//check if this is the first mc being loaded
[code]....
View 6 Replies
Aug 22, 2010
I'm trying to check through an array to see if any of my movie clips are currently on frame 15, before taking giant leaps I was trying to just get it to work with one var in the array before all of them, for some reason this code is not working, the trace is not coming up.
Code:
stop();
var anybtn:Array = [btn1_mc, btn2_mc];
trace(anybtn[1]);
btn1.onPress = function(){
if(anybtn[1]._currentframe == 15){
trace ("Array Check Working"); .....
If someone would like to go a step further and show me how to check through all movie clips. There will be many more than btn1_mc and btn2_mc so I will definitely need to use an array.
View 4 Replies
Dec 11, 2009
I am trying to do a multiple if statement checking to determine which frame label within a MC (NE) and is located on frame 3 of the main timeline, to display. In the main timeline frame 1, I have declared a new var:
var n_e;
button1.onRelease = function (){
n_e1 = 1;
main timeline go to and stop at frame 3
}
[Code] .....
But it doesn't seem to work, and most of the time it lands up on Ne("2") instead...
View 6 Replies
May 12, 2011
I have a character that should move using standard WASD control. I've tried to implement that using a listener for the KeyboardEvent.KEY_DOWN. However, it seems that what I get is:
1) Only one key at a time (ie I can't read both W AND A being pressed down at the same time)
2) When holding down first the events come in not every frame and later they come in every frame, ie, regularity of events relates to the system's sticky key.
What I would like is a solution where if I press the key W I continue moving to the left until the key is up. If I press multiple keys then I should move in the combined direction. What would be the best way to implement this? Do I need to listen to both KEY_DOWN and KEY_UP events and then use those as switch for movement? Is there a "good practice" way?
I got smooth movement/etc when I implemented both key_down and key_up. Essentially I made 4 booleans saying "move right/left/up/down" The boolean is set true by key_down event and false to key_up event. Movement itself is performed on enterFrame event based on how the booleans are set. Still wondering if there is a better way..
View 15 Replies
Feb 1, 2010
If I have one parent class that instantiates 5-10 different child classes, each of which need to load multiple assets etc, how can I check within that parent class to make sure all of the 5-10 children are loaded & ready to go before telling the program to continue?
The tricky part is that the exact number of those 5-10 classes that are instantiated is determined at runtime, so I can never be certain which I should be waiting on and which not to be waiting on. And just to be clear, these are different modules of sorts, not multiple instances of the same exact class.
View 3 Replies
Jun 20, 2011
Okay, here's the rub. I'm making a little maze game. In this maze game, I have walls. They link to a class called Wall.as. In order to collision detect with the player, I do this:
MovieClip(parent).checkCollisonWithPlayer(this);
Where (parent) is a manager logic class. The parent does this
public function checkCollisonWithPlayer(wall:MovieClip)
[code].....
View 2 Replies
May 18, 2010
I have to create a slideshow that loads 16 different swf's into a container_mc. Each swf has an image with accompanying voiceover.
I have the basic next, previous, first, and last slide buttons working but they want to add a slider bar that plays and u can slide to a specific section of the slide show. The slidebar is where I am having troubles.
Here is what I have so far...
This is the code on the first frame for the buttons
Code:
nowPlaying = 1;
lastPlayed = 0;
playingNext = 2;
autoPlaySlides = false;
[Code]....
For the slider I need to create some kind of loop that checks where the dragger is. If it is between 1 and 6 slideLabel = "Go to slide 1"; If it is between 7 and 12 slideLabel = "Go to slide 2"; and so on up to 16... when the dragger is released on the slide the user wants to go to it needs to load specified .swf.
View 1 Replies
May 18, 2010
I have to create a slideshow that loads 16 different swf's into a container_mc.
Each swf has an image with accompanying voiceover.
I have the basic next, previous, first, and last slide buttons working but they want to add a slider bar that plays and u can slide to a specific section of the slide show... The slidebar is where I am having troubles.
It is partially working now, just needs to be tweeked... It is reading the variables, and setting the slide label text to the correct label, BUT it is only doing this once when the mouse is pressed and does NOT update when the mouse is dragged. I tried so many different ways and can't figure this out.
Here is what I have so far...
This is the code on the first frame for the buttons
Code:
nowPlaying = 1;
lastPlayed = 0;
playingNext = 2;
[Code].....
For the slider I need to create some kind of loop that checks where the dragger is.
If it is between 1 and 6 slideLabel = "Go to slide 1"; If it is between 7 and 12 slideLabel = "Go to slide 2"; and so on up to 16... when the dragger is released on the slide the user wants to go to it needs to load specified .swf.
View 2 Replies
Jun 7, 2010
I'm working on a quiz-style piece right now and in short it's several pages of multi choice questions, each rewarding a certain point amount that is added up at the end and given specific results based on the point range scored. (i.e. 10-20 = good, 21-30 = great... etc)
For code I've stopped here:
if (answercheck == 40 - 52){
trace("Feedback: Range 40 - 52");
form.gotoAndStop(3);
form.AnswerTotal.Number = answercheck;
}
Answercheck is the var with the total points accumulated. Form is the mc with the feedback frames based on their point totals. AnswerTotal is the dynamic text box I'm trying to load the exact point total the user acquired into at the end.
View 2 Replies
Feb 5, 2012
[Code].....
I have a group of 16 images that I would like to load 1 of each into each movieclip. I want image1 to be inside of visual1, image 2 inside of visual2, and so on. the images are named like, 1960s_(1).png where the 1960 (year) part is coming from the rangeNum variable. The above gives me this error: 1061: Call to a possibly undefined method addChild through a reference with static type int.
View 4 Replies
Sep 16, 2009
I have 50 images that need to be on stage, which will be embedded into 50 different movie clips. I named the movie clips image1-image50 and the images are in an external folder named 1-50. Every freaking article or tutorial I have found clearly explains how to upload one image, or just one at a time. I can do that, and spend 2 days renaming all the functions, but I do not want to do that. Is there a better way to just load all 50 images, place them accordingly?
View 3 Replies
Oct 26, 2009
I have 24 movie clips on the stage: my_menu.image_holder_mc1 thru my_menu.image_holder_mc24. I want to load an image in each one. How do I identify the holder which to add a child.
The Code I have so far is....
Code:
for (var i:Number=1; i<=24;i++){
var myLoader:Loader = new Loader();
myLoader.name = "image_"+i;
[Code].....
View 2 Replies
Jul 2, 2009
I have built a MovieClip called TestMovieClip.
The first frame includes the actionscript[code]...
View 2 Replies
Sep 6, 2010
I'm trying to develop a site map, which draws a tick over the sections of my app that have been completed. I've figured out how to draw the tick and how to pass variables from root to the MovieClip that the function is in.
To make the tick appear only after an mc has been watched, I tried setting a variable equal to 1 ino the last frame of the MovieClip, and telling the function to run if that variable was 1.
I'm not getting compiler errors, but I'm also not getting the tick. And I'm definitely completing the Movie
Here's what I've got so far: In root
Code:
var xcoord = 125;
var ycoord = 300;
var WaterComplete = 0;
In WaterMovie
[Code].....
View 3 Replies
Jul 21, 2005
I need to know how I would use a variable as a movieclip, like me expain with an example:
currentMovie = "MovieClipName";
_root.currentMovie.gotoAndPlay(2);
I want to have 'MovieClipName' to be the movieclip that plays.But obviously AS 2 things I'm asking for 'currentMovie' to play but its just a variable.
View 2 Replies
Jun 16, 2008
I have finally started with AS3 and flip-'eck its a different animal that AS2
I have a swf called login.swf and in it have declared the variables var total:uint=0; and loginState:Boolean=false
All my scripts for logging in sending/receiving variable from/to server scripts are all working!
So... when a user supplies a correct password another swf (userLogged.swf) is loaded (note: in AS3 this process is seriously different than in AS2) swf dont seem to be loaded 'into' another movieclip anymore... and this leads me to the puzzle!
How do I access variables declared in the project.swf, from within the userLogged.swf!
the old AS2 way = trace (_root.loginState);
or trace (_root.project.loginState)!
I am stumped by this new approach of AS3 of loading in other swf files. The _root. options is no longer available in AS3 (that much I've descovered, some tuts say use root. but I cannot get that to work)
trace (root.loginState)
or
var userLoggedIn=root.loginState
gives me the error
1119: Access of possibly undefined property loginStatus through a reference with static type flash.displayisplayObject.
when I try to publish the userLogged.swf
View 4 Replies
Jul 3, 2009
(Using AS3) I'm doing a simple grid layout of boxes (movieClips), i'm then trying to save their current position to each of the movieClips. So in AS2 i'd do something like ...
obj.origX = obj._x;
obj.origY = obj._y;
but it's saying; 1119: Access of possibly undefined property targetX through a reference with static type flash.displayisplayObject. How can i add custom variables to movieClips?
View 3 Replies
Sep 22, 2010
I have several Movie Clips in the Library which I need to be able to load and bring up on the screen randomly.The code below shows how I can load one of these, but to get a proper control ideally I would like to load them all in to an array or numbered variables so that they can be called from a simple piece of code and actioned one at a time.
My movieclips can all be called something simple like mc1, mc2, mc3, mc4 etc to make things easier.These need to be referenced in to an array mcContainer[.....] or as mcContainer1, mcContainer2........ so that they can be called easily.I just need to know the simplest way to do this and how i reference them, I have tried several ways like ["mc"+i] etc and nothing seems to work.
Code:
var mc:mcLogo=new mcLogo();
addChild(mc);
View 4 Replies
Aug 9, 2011
I'm new to actionscript 3 and I'm trying to get a few simple things going, such as setting variables in other movieclips... So let's say I have an "apple" movieclip on the root/stage, and I want to access other variables on the root, or in other movieclips. How would I do that? In actionscript 2, I would use something like
_root.thisVar = 1;
_parent.thisVar = 1;
and with other movie clips I would use
[code].....
View 1 Replies
Mar 25, 2009
How do you do something like
["button"+num].gotoAndStop(2)
eval("button"+num].gotoAndStop(2) doesn't work either?
Also how do you do _root.?
[code].....
View 2 Replies
Apr 18, 2010
I have a series of movieclips stored in the .fla library
Clip1 (class: clip1)
Clip2 (class: clip2)
Clip3 (class: clip3)
Clip4 (class: clip4)
Clip5 (class: clip5)
I want to be able to add each clip to the stage using a function where the number is a variable that can be added to the "Add movieclip" statement.
For example:
var x:Number = 1;
var "Clip" + x:"clip"+x = new "clip" + x();
so that the program inteprets the above as:
var Clip1:clip1 = new clip1();
addChild(Clip1);
This was the only way I could think of adding a movieclip to a stage. I am open to any other option. I hope this was clear. I don't have any code to post because I'm just trying to work through the logic of the program. Adding movieclips to the stage when the name of the movieclip has a variable in it, is the part I am stuck on.
View 6 Replies
Jun 12, 2009
I want to reference clip with some variable name because i want to change dynamicaly target clip. Example:
myMC="testClip";
myMC.my_txt="some text";//this doesn't work
//but this works
eval(myMC).my_txt="some text";
I guess eval() is not right thing to do.
View 4 Replies
Aug 26, 2009
I built my website on the main timeline with a fade in animation...stop(on the page) and a fade out animation. At the end of this fade out animation i would like it to call upon a variable to know what page to go to next.I am trying to tell my main timeline to gotoAndPlay a frame based off of a variable within a movieclip(about_mc this movieclip contains another movieclip which acts like a button(factsheet_mc)) that i have set in my main timeline.I set the variable with:
var buttonFrame; in the first frame of the main timeline
then within my movieclip i have another movieclip which tells my main timeline to play the out fade and remember a variable:
this.onRelease = function(){ --------"this" meaning the movieclip factsheet_mc------------ [code]........
View 1 Replies