ActionScript 3.0 :: Display Certain MovieClip Depending On Variable?
Feb 9, 2012
I have a project where I want to display a certain movieClip based upon what variable was set earlier. I have 5 different MovieClips that need to display depending on variables.
I have the variable set and working, but how can I script this to make it that if a certain variable say Var1 is set, then it chooses to display Var1_mc?
Can I just have it load the correct one, or do I just have it change the alpha setting of the correct one?
View 8 Replies
Similar Posts:
May 4, 2011
I'm making a platform game where all of my level components (ground, background etc.) are within an array called 'levelArray' so I can move all the elements the same amount at the same time. I'm just starting to implement my second level, and I need to change 'levelArray' to contain different level elements. I've tried to put an 'if' statement to change the definition of the variable:
[Code]...
View 3 Replies
Oct 2, 2011
Basically I want to define a variable in a movieclip and then display that in a textbox outside of the movieclip. To be a little more specific I want to make a variable be false and then when a movieclip gets to a certain frame the variable is set to be true. The true will then be displayed in a textbox on the main timeline.
View 2 Replies
Jun 16, 2006
I'm just trying to have a textbox on my main stage display certain values depending on what frames are being played. So having not done actionscript in a LONG time, I would assume is it something like this:
[Code]...
View 3 Replies
Mar 25, 2009
I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.
But - I need to be able to direct to different frame numbers depending on the variable, this is working.
But when I place this code:
[Code]...
View 2 Replies
Sep 13, 2010
Is there a way to set up an unseen variable in flash sort of like keeping score?The best way I can describe it is from the BASIC language I used to use back in the day, where on a click you can make x=x+1, or x=x-3, or whatever depending on the button you click on.And then it would display the score (i.e. whatever is the current value of x) in the corner? give me a link or the actual code you would assign to a single button that will add or subtract to a displayed score in the corner.
View 10 Replies
May 11, 2011
I have several textfileds in a movie clip and I want to change text in a textfiled depending on which textfield you have clicked on. So if I have clicked on at textfiled named "text1" i want:
[Code]...
And then will text1 have the same text as "inputfield", but this dosen't seems to work only if you had a textfield called "textvariable" but that is not what I want. So any ideas how you can make this function?
View 6 Replies
Apr 28, 2004
I have set the variable in my page using <param name="flashvars" value="menustate=<?php $pagename; ?>"> which works perfectly fine when I use a dynamic textbox in flash with the var name menustate.
But I need to send a MC to frame 2 if 'menustate = 2'. Anyhow, I just want to know how to control a MC with an external var. I can't use loadVars () because this var is coming from any page, not just one.
View 5 Replies
Jun 11, 2010
Is it possbile to make 'bumblebee' a variable?
var mybee:bumblebee = new bumblebee();
View 5 Replies
Mar 25, 2009
I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.
[Code]...
(in case it was a string vs number issue.) it just stops - it does not go to frame 30. I need this because I need the file to stay on frame 1 if no variable is passed in. Am I doing something obvious wrong? Is there a better way to do this?
View 1 Replies
Aug 31, 2009
Essentially I'm just trying to rotate an object (mc) clockwise or anticlockwise depending on the value of a variable called 'angle'.If 'angle' is positive it should go anticlockwise.If 'angle' is negative it should go clockwise.
Option 1
PHP Code:
if(angle > 0) {
mc.rotation += rotateIncrement;
}
[code]....
View 3 Replies
Mar 2, 2011
package {
public class priyan {
public var a:String = "priyan";
public var b:String = "bhagavath";
public function method():void {
trace(a);
trace(b);
The above script, i got it from one of the ActionScript 3.0 book. i just work it out in flash. But it shown error 5000: The class 'priyan' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
[Code]...
View 1 Replies
Nov 28, 2006
I'm creating a christmas calendar in flash, where naturally the movieclips representing days should be activated based on the day of the month.
I'm successfully passing the variable to flash in PHP ( I know because I used a textfield to see if the variable existed.) Then, in a external .as that is loaded after the variable is accepted I have the following code.
Code:
for(var i:Number =1; i< dagens; i++){
aLuker[i] = eval("nummer"+i);
aLuker[i].onRelease = function():Void {
[Code]....
This code is supposed to enable the clips "nummer1, nummer2, ... nummer24". I know that the aLuker[i] = eval("nummer"+i) assignment of the movieclips is correct, as I use the same method earlier in my script to set the text in a textfield inside the movieclip.
What actually happens is that although the variable exists in Flash (as a _global even) flash ignores it and enables all the movieclips.
View 1 Replies
Sep 21, 2010
so i have a movieclip with this script on it (this makes my movieclip rotates)
ActionScript Code:
onClipEvent(enterFrame){
angle = (Math.atan2(_root._ymouse-_y,_root._xmouse-_x)*180/Math.PI);
[Code]....
Now, i have (let's say) 30 frames inside this movieclip, and i wan't it to change is current frame depending on the angle of the mouse (example, if i point my mouse to the right, the mc goes to frame 30, if i point my mouse a little up, the mc goes to to frame 27, if i point my mouse all to the left the mc goes to frame 15... etc...)
Basically the movieclip should change it's frame depending on the mouse angle,
By the way, i don't really wan't the moviecliip to rotate (like it's doing now) i want it to change it's frame only...)
View 4 Replies
Jul 26, 2009
I have started to make an interactive movie where pushing keys moves a movie clip around the stage! And I can obviously make the movie clip do what I want, so here is the question: I want to make the movie clip change its animation depending on which keys are being pushed i.e. Left key the movie clips moves left, and my stick man changes to a running animation. Push nothing and it changes back to his standing still animation.
View 2 Replies
Nov 4, 2009
I having a hard time on a small task that I thought was easy to accomplish, but it is taking me longer than expected and not the results I am wanting.I am developing a shooting game. I have a hero that can shoot only so often (once every half second for example). I am trying to scale a MovieClip depending on how much time is left to be able to fire again.
So when the hero shoots the gun, the MovieClip will have a scale of 0. When 250 milliseconds has elapsed, the MovieClip's scale should be at .5, assuming the gun can only shoot every half second.
Can anyone provide code on how to accomplish this? This is what I have to keep track of when the hero can shoot next,
[Code]...
View 1 Replies
Oct 28, 2010
This is a CS4 file so and I have CS5 so if you give me either it will be awesome
I have a movie clip that follows the mouse..
Its not done yet but its gonna be a dog chasing a/the mouse...
I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like
if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left and one for right up down (I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse..
(say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section??? like the equivalent of onRollLeft or whatever.)
this is the code i have.. its the top statement that doesn't work the bottom 2 do..
Code:
if (_xmouse < detail.x+10) {detail.gotoAndPlay(61);
}
detail.onRollOver = function() {
detail.gotoAndPlay(31);
[Code].....
I already created the shapes and placed them in the appropriate frames.. you should only need to mess with the actions on the instance "detail" (the dog face in frame 1 of scene 1 in layer "follower" ---- just the actionscript needed for that instance is needed in the reply.. you should not need to chage any of the layers, but if you do just tell me what you did and why.
my fla is to big to upload to this form so im placing it on my website here
View 2 Replies
Oct 28, 2010
Its not done yet but its gonna be a dog chasing a/the mouse. I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like
if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left
and one for rightup down(I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse.. (say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section???like the equivalent of onRollLeft or whatever.)
[Code]...
View 3 Replies
Dec 24, 2011
how to change the volume, asking how to detect the actual volume (not the set 100 volume) of music/sounds. does flash even detect the actual volume output? So when the volume is 0 (e.g. maybe at the end of a song) the ._alpha is 0, so all I need is a variable for the output volume of a song.
View 1 Replies
Aug 12, 2010
I'm attaching the file so that you guys can see that? pretty basic. My main problem is to find out how can the mouse check the mouse position on stage and make the coverflow animate and the movieclip change angle depending on the side, I have to animate only 5 itens, here?s the AS:
[Code]....
View 8 Replies
Jun 22, 2008
I`m trying to set-up a script that changes the color of a movie clip, depending on the current url of the page... My code is:
Code:
var link = "http://localhost/v-v/indexSRP.php?kategorija=";
var link2 = "http://localhost/v-v/index.php?kategorija=";
if (_root._url.indexOf(link + "3") == 0) {
[Code].....
View 5 Replies
Jun 7, 2005
Is there a way of making a normal loadVars.load load a url depending on a variable you set in the swf?
var reciever = new LoadVars();
loadurl = "test_onload_3.cfm?propertyID="+MY_VARIABLE_GOES_HERE;
reciever.load(loadurl);
so that I can set my variable and then load the variables with the propertyID that I choose in the swf??
View 4 Replies
Jul 24, 2009
is there anyway to change a songs playback speed depending on a speed variable. heres the kicker tho im limited to using only as2.
View 2 Replies
Nov 24, 2004
Here's what i'm trying to do: Hide a MC depending on the path variable as:
[Code]...
Well that doesn't work, for some reason, i can't use a string as a multiple level path..
View 5 Replies
Jul 8, 2011
I was wondering if there is a shortcut so i can always set a MovieClip to display at the tippy top of the display list?
Also i understand that WebViewLayer will always display above the display list.
View 1 Replies
Oct 9, 2007
I have recently followed a tutorial to make a movieclip in flash that makes buttons spin around a point depending on the mouse position. I have made my own version off this and would like to use it in a full flash website that i am making at the moment.
The only problem that i am having is with aligning this clip and as it is made up of script i cant physicly drag it to were i want it. I understand how to alighn this with x/y positioning but when i preview the flash in a web browser it is positioned correctly but then when i 'full screen' the browser this clip jumps about 4 inches down the page.
View 1 Replies
Apr 2, 2012
I'm currently working on editing the pages on my website but for some reason these errors are apearing. Also some of the text that should be on the .swf disapears. Any help will be apreciated
This is error I am getting:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::SimpleButton@40692fa1 to flash.display.MovieClip.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
[code].....
View 7 Replies
Aug 21, 2009
I want to declare a variable on the main timeline that can be called from anywhere in my movie. So, _global var should be the right approach. I want to declare a movie clip 'MC1' "open", or "closed" so that when it is revisited, my flash file knows the user has been there before and performs a different task from the one it does when 'MC1' was first encountered. So, i need a 'if' statement to run from the variable, when the playhead encounters the movieClip.
[Code]..
View 2 Replies
Mar 20, 2009
i have a Tweener question....here is the lib..so here is the error i get?
## [Tweener] Error: [object Loader] raised an error while executing the 'onComplete'handler.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@2035d1c1 to flash.display.MovieClip.[code].....
and here is why:
Code:
import caurina.transitions.*;[code]....
i tryed to use just the loaders...not working..its just for mcs i think...
View 5 Replies
May 15, 2011
For my project I need to copy the graphics of a Movieclip with all of its children without copying anything else into a second Movieclip. I cannot use the Bitmap classes because I need the graphics to be displayed as a vector and I cannot use a method that simply copies the clip by calling the instructor ie:
var copy:MovieClip = clip.constructor. Is there any way to copy only the display portions of a clip into another Movieclip without turning it into a bitmap?
View 1 Replies