Flash8 : Using Variables Over Timelines (AS2)?
Feb 11, 2010
My variable from the root timeline is not being sent to say a timeline inside a moveclip. This is basically my code:
On root timeline:
Code:
stop();
showred = false;
Inside movieclip instance 'infobox' on timeline:
Code:
stop();
if (showred == false){
play();
}
the showred variable inside the 'infobox' movieclip is not detecting that I set 'showred' to false on the main timeline.
View 2 Replies
Similar Posts:
May 7, 2011
Flash CS4, ActionScript2.0 - I have a button and an input text box in a movieclip.When the button is clicked, I need the movie to jump to a frame on the main timeline and have the text that was entered into the input box in the mc, show up in a dynamic text box in the frame on the main timeline.I finally got the movie to jump using 'with (_root) gotoAndPlay ("frame label"), but I can't get the input text value (in the mc) assigned to the dynamic text box (on the main timeline).I've tried several versions of relative and absolute paths in the assignment statement, using variable names and instance names, tried 'with' and 'this' but no matter what I do, nothing shows up in the dynamic text box.
View 8 Replies
Mar 26, 2011
I have some main time line variables I need to access and manipulate from inside a movieclip timeline. However, when I try to subtract from a global variable, one that's declared on the main timeline on frame 1 outside of a function/whatever, it says:Symbol 'lemon_cup', Layer 'actions', Frame 1, Line 54 1120: Access of undefined property lemons1.
View 1 Replies
Aug 4, 2010
just getting the grip around the variables and im experimenting. This is what i have as a variable
money = 1000;
health = 100;
Then i have the dynamic textbox that shows them. works great, and i also have various effect that makes the two go up and down. Here's the problem, or more, how i would like to expand the concept but is stuck on. Right now both variables can go as high and low as possible (of course). Is there something i can add in that script that makes so the money variable can't go below 0. Also is there something i can add so that the Health can't go ABOVE say 500 and when health reaches zero (or a negative) this triggers _root.gotoAndPlay("gameover"); you get what im trying to achive here
View 15 Replies
May 31, 2009
Is it possible to put variables in an array?
For example:
Code:
var positions:Array = new Array(Stage.width / 2, Stage.height / 2);
When the above code is executed, the values "Stage.width / 2" and "Stage.height / 2" are replaced with the number values and the array becomes, for example [500, 400].And when I call the array positions[0], instead of getting the value of the Stage.width / 2 (considering the stage has been resized), I get the static value of 500.What can I do to get the value of Stage.width / 2 ?
View 1 Replies
Feb 28, 2010
what is wrong with this syntax
_root.range+towerID = 75;
i want flash to read the variable as _root.range2 = 75. this is for each tower so _root.range2 -= 10 reduces tower 2's range by 10 (this is done on a different frame thus the _root. is needed)(towerID is calculated above)
View 1 Replies
Mar 3, 2009
Ive got a script lined up:
Code:
onEnterFrame = function(){
if(aktiverPublisering == "true"){
function avpubliser(){
[code]....
Ive checked if "aktiverPublisering" traces "true", and it does (it declares "true" through a button)... So, here's the weird part...i cant get a trace inside the IF statement i.e. its not working...
View 2 Replies
Dec 25, 2010
Actionscript Code:
if (Key.isDown(attack2Key)&&shot2reload == 0) { for (i=1; i<2+1; i++) { shot2++; shot2reload = 30 var newname =
[code].....
View 1 Replies
Mar 12, 2009
So I have a laser game I'm working on and I have a setInterval set up for when the laser button is pressed that it shows the laser for a little bit before removing the incoming asteroid and hiding the laser. I have a four of these buttons each with different colored lasers. So I thought it would be easy to pass the movie clip in through the function, cause I've done that with regular functions. Problem is, I don't know how to do that with a setInterval function. The way I have it set up shows the lasers then crashes and just shows a blank screen. Here is a bit of my code:
Code:
function laserMultiFire(laser:MovieClip) {
if(astroid == true){
_root[laser + "L"]._visible = true;
[code]....
The btnMulti is one of the buttons, and there are three movie clips that represent the lasers, the ones I'm trying to show and hide here are mcLaserMulti, mcLaserMultiL, and mcLaserMultiR.
View 1 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
Sep 11, 2009
I've read on the net that actionscripting from the action layer will result in a more readable file once published, as apposed to attaching onClipEvent functions which slow down readability.
For this reason I am trying to add variables to a MovieClip I have on the stage with an Instance Name of Player. However I wish to assign the MovieClip variables from the actions layer using the MovieClips Instance Name.
[Code].....
View 5 Replies
Dec 4, 2009
I'm trying to import some variables set up in a .txt file. However the variables that I would like to behave like numbers are not doing so.
I have a variable in the text file called "&middleimg=1" when I pull this in and say do the following:
Code:
var numvar:Number=0;
numvar = _root.myvars.middleimg+1;
I get "11" rather then "2" as the result. I tried setting up my text file as such: "&middleimg:Number=1" but get an "undefined" result. Is there anyway to get imported variables to behave like a number instead of a string?
View 2 Replies
Jan 7, 2007
how to pass variables from a parent swf to a child swf loaded into a movieclip container within the parent swf.
View 6 Replies
Mar 31, 2009
Is there a way of tracing variables in an object without expressly listing each of them?
e.g.
Code:
so.data.thename="derek";
so.data.thenumber=1234;
so.data.sex="male";
[Code].....
View 1 Replies
Jun 26, 2009
I am making a game using AS2, in which the user controls the character with WASD. I am making a tutorial level in which the level only advances past the first frame after the user has pressed W, A, S, and D. The level is a single frame in which there is a movieclip that has all the enemies. I made an offscreen button in the movieclip which has the code
Code:
on(keyPress "w"){
var w:Boolean = true;
}
[Code].....
When I run it, nothing happens and it stays on the first frame of the movieclip. No errors are shown in the output panel.
View 2 Replies
Oct 24, 2010
I programming a calculator, I get data on Yahoo Finance ( URL... ), but sometimes I get this error "NaN".URL...[code]
View 1 Replies
Dec 16, 2010
I have a button instance mc "mcBtn",inside this instance i have the actual Btn graphic symbol and AS layer.inside the AS layer i have defined onRollover, onRelease, onRollOut methods.if i rollOver/Out/Press Btn it works fine and Btn animates in some way.
I needed to access mcBtn from _parent timeline AS WELL, so i defined a method mcBtn.onPress [one which is not defined inside mcBtn yet], and inside onPress told mcBtn to animate some other content.... What happened is, that onPress works fine and after pressing Btn, requested content is animated, BUT all other methods defined inside mcBtn stopped working! [no animation when rollOvered, rollOut-ed, onRelease-d]
Q: how to make all those methods work?
View 11 Replies
Jul 13, 2010
I have an event listener which is listening for a click in a the button 'home_btn';
ActionScript Code:
home_btn.addEventListener(MouseEvent.CLICK, opacityTween1);
However I am getting 'Access of undefined property home_btn. in the compiler errors. I presume this is because the home_btn is in another timeline/movie clip called 'opacity'. How do I define it?
View 2 Replies
May 8, 2009
I have added an attachment to this file. What I want to happen is, when I click 'blueBtn' I would like 'pic1' to fade to alpha:0 (using TweenMax)... It seems simple enough but I just cant get it to work.On the Greensock Forum someone gave me this bit of code without any real explanation, how do I put it to use?:[code]
View 8 Replies
May 31, 2009
I have all my layers made and graphic symbols in each layer.I want to create a timeline for my graphic to fade in and out. (Know how to do that)When I lock my main layer and work within my selected layer:1. drag the graphic onto the stage2. select a frameThis is where the problem comes in:My main layer (with my background) disappears and I'm left working on a white stage (not a problem I know how to make the stage a color)When I test the movie:I get white - no motion - and then the background flashes quickly. (I set my last frame at 100 so that it would loop slower).
View 3 Replies
Jun 2, 2010
I'm aware that ActionScript 3.0 is designed from the ground up to be a largely object-oriented language and using it means less or even no timeline code in Flash documents.I'm quite experienced with OOP and am comfortable writing classes. However, since I mostly use Flash for animations, I hardly ever need to write ActionScript code other than for preloaders, subtitles, quality controls, website links and so on. In fact, I still set my Flash movies to use AS2 to this day because I'm used to gotoAndPlay()/gotoAndStop(), AS2 preloaders, subtitles, quality controls and even getURL(). Of course, I really want to move on now that practically everyone's on Flash Player 9 or 10 and now that I've dabbled with other OO languages like Java, C# and Objective-C too.
I'm a complete newcomer to AS3 and am not very learned with AS2 either. Considering my current use of ActionScript, are there any cases where it's still OK to use very simple AS3 code in the timeline instead of moving code to a class, especially since moving to a class might mean unnecessarily increasing the number of LOC from 4 to 40?
View 2 Replies
Dec 5, 2010
I have a game with 3 levels and a reward page. I want to display the number of tries on the reward page. The levels and reward page have their own label within the main timeline. How can I pass the info from a level, to the main timeline and how do I retrieve it on the reward screen?
View 7 Replies
Jun 20, 2005
I have a button instance mc "mcBtn", inside this instance i have the actual Btn graphic symbol and AS layer.inside the AS layer i have defined onRollover, onRelease, onRollOut methods.if i rollOver/Out/Press Btn it works fine and Btn animates in some way. I needed to access mcBtn from _parent timeline AS WELL, so i defined a method mcBtn.onPress [one which is not defined inside mcBtn yet], and inside onPress told mcBtn to animate some other content....
What happened is, that onPress works fine and after pressing Btn, requested content is animated, BUT all other methods defined inside mcBtn stopped working! [no animation when rollOvered, rollOut-ed, onRelease-d]
View 3 Replies
Aug 10, 2007
I did the drop down menu tutorialut I don't know how to assign actions that will affect the main timeline, Right now assigning any actions to the buttons only affects the timeline within the drop down menu timeline. An example of what I want to do is apply a goto action to one of the buttons that goes to a frame on the main movie timeline.
View 2 Replies
Nov 11, 2009
What I want to know is how to I access movie clips in different timelines in AS3.I want to be able to change the color of some movie clips. If I can access them directly there's no problem. Problem is when I try to access a movie clip that's inside another movie clip AND on frame 10.what I have is this:
var myColor:ColorTransform = somePath.transform.colorTransform;
myColor.color = 0xFF0000;
somePath.transform.colorTransform = myColor;
[code]....
View 2 Replies
Jul 2, 2010
With AS2 is it possible to use the current frame postion of the main timeline A to control the position of two mc timelines B,C relative to the current frame postion of mc D?the main and mc timelines have the same No of frames.
View 3 Replies
Apr 20, 2010
I created 5 swfs (simple animations) and want to "somehow" thread them together to play one after the other inside the timeline of a new Flash Document. I was hoping to import each swf, have "movie 1" play, stop, have "movie 2" play, stop and so on until the 5th "movie plays out then stops (no looping necessary).
I've been playing with timeline actions for 2 days and can't figure how to lead one to the other. I've been using Action Script 2 so far but please get me back to Kansas with this. I'll use Action 3 if I have to.
View 3 Replies
Sep 1, 2010
I am using Flash CS4. Is there any way to adjust the length of multiple timelines at once? I am doing an animation of leaves falling from a tree. The leaves alone have 17 separate timelines on separate layers plus each has it's own guide layer.If I had the ability to to select all of the timelines together and adjust all of their respective start and end times at the same same time, relative to each other as well as separately, life would be so much easier!Of course I can do it timeline by timeline, no problem, but I can't seem to adjust the length of more than one timeline at a time. (no pun intended)Even when I select more than one timeline, the double arrow only adjusts the length of one timeline. Even each guide layer's length has to be adjusted separately. I understand the benefit of this, but, testing timing and making adjustments would be so much simpler and go so much faster if I could select and drag multiple timeline lengths at the same time.
View 3 Replies
Nov 4, 2010
Say you have a keyframe on 1 and a keyframe 25 and a keyframe on 50. Can I grab 50's key and scale down? So could I grab 50s key or all 50 frames and scale down to say 25, and then the key would be in the middle still (guessing 12 or 13 for the middle key). Until then I'll manually drag keyframes using Ctrl. It just would be nice to easily scale down keyframes/frames even if it's not 100% precise.
View 5 Replies
Nov 10, 2010
I have the following code:
var myParent:Parent = new Parent();
var mySymbol_01:Symbol01 = new Symbol01();
var mySymbol_02:Symbol02 = new Symbol02();
[Code].....
and remove the comments, the file breaks and no Movie Clips appear on the stage. Does this have to do with casting the Children as Movie Clips, which I may not have done here?
View 5 Replies