ActionScript 2.0 :: Put The Character Variable And Info In The First Keyframe And Refer To These Via _root In Any Frame
Dec 29, 2010
I am trying to make a game to learn actionscript. my game is going to have multiple keyframes, ie one for dungeon, 1 for a large map yadda yadda yadda. Things like the character i would like to be available to all keyframes. i am assuming i put the character variable and info in the first keyframe and refer to these via _root in any frame. However if i want to make a dungeon and use the dungeon scene variables i would use this.
right now since i am only on the making a dungeon part i can refer to anything using this or _root. Case: my dungeon scene consists of walls and paths. right now i can do something like if(_root["path" + yPos + xPos]) _root["path" + yPos + xPos].removeMovieClip;
i can also call the same code using this instead of _root and it works. when i add a main new main frame and move the dungeon scene from frame 1 to frame 10, will i still be able to inter use _root and this and have the same effect, or once i move the dungeon scene from frame 1 to frame 10 i will no longer be able to use _root. also i only have 1 layer.
View 3 Replies
Similar Posts:
Jan 19, 2012
I want to get information of an object from a previous keyframe. _root. works only for objects on the same keyframe as the code right?
View 1 Replies
Mar 20, 2007
i'm making a game and to score some extra performance im rendering every frame of every entity into an array of bitmapdata's the first time the frame is seen, and it works well, but its wasting alot of memory because we have alot of animations, and most of them are double framed at least, so more than half of the bitmaps could be ignored if there was a way to determine if a frame is a keyframe or not
View 3 Replies
Mar 16, 2005
When I place some codes in a keyframe, these codes are showing on all the following frames up till the next keyframe with codes. My question is, does Flash execute codes only in the keyframe or it execute whatever is in the frame regardless whether its a keyframe or not?
View 1 Replies
Sep 24, 2010
I have a 9 frames image of a character.In other language generally i used to make character animation by looping the array consisting of different frames and drawing each frame when pressing key.What i want to do is when i press left or right key, i want to draw each frame that makes character movement and update x coordinates of frames, and it will appear as character is moving.
View 4 Replies
May 7, 2006
When you click a button I want my flash to go to the frame label where the movie clip is located, and then play a certain frame of that movie clip.
View 5 Replies
Nov 3, 2010
I am trying to get just a single pose from an armature layer without copying the whole layer. I just want the exact arrangement of symbols from a specific frame of the armature layer alone; in one keyframe; without the armature; into a normal layer. I tried a few things, like breaking apart and copying the individual keyframe (ctrl+click on the frame I want and "copy pose"). I thought about converting an armature layer into a frame-by-frame animation so I can just copy the one frame like I want, but it's apparently not an option. When I tried the break apart option it just breaks down the first frame of the armature layer into one big vector graphic. I've even tried highlighting every frame except the one I want to use and pressing Shift+F5. Nothing I've tried so far works.
This is annoying because if I don't find a solution, I will have to take each separate symbol used in this frame of the armature layer and individually align them all in the exact same position in the normal layer
View 2 Replies
Mar 27, 2011
I want to call a function once per frame between keyframe 1 and keyframe 60, but i don't want to have to create a keyframe on EVERY single frame in between with an action calling the function. is there a simple way like tweening, to make this function execute once on every frame without having to make 60 unique keyframes?
View 1 Replies
Jun 10, 2009
How do I refer to a variable using strings and other variables? What I mean is, for example, you can refer to an instance of a MovieClip on the root level with instance name "mc1" by doing this[code]...
View 5 Replies
Aug 8, 2006
asically I have a variable in which I store various numbers depending on other aspects of the flash movie and I have a bunch of movieclips that are on the stage all named by number. I want to use the variable value to access and run methods etc of these movieclips.
e.g.
var myVar = "10";
myVar.myFunction();
where the item on stage called '10' will react. I realise this is a confusion between a string and an object/movieclip reference but i'm almost certain ive done this before and ive got a feeling it had something to do with [] brackets on the end of something...
View 5 Replies
Aug 18, 2010
Trying to set up a world of warcraft like hotkey setup for an RPG i'm making for a school project, where you drag spells from the spellbook onto the hotkeys. Understand all the concepts, however, instead of doing a ridiculous amount of if statements, I want to loop the functions. Unfortunately, I don't know how to refer to certain variable and instance names within loops. I shall show you what I have:
ActionScript Code:
for(var i; i<2; i++){
spellbook_inst["spell_"+i+"_inst"].onPress = function(){
this.startDrag();
_root.hold_spell_position_inst._x = this._x;
_root.hold_spell_position_inst._y = this._y;
}}
The "spells" (i.e., icons you drag from the spellbook) are all named spell_(number)_inst, and are movieclips within the spellbook_inst movieclip. I want the drag function to be available for all spells. At the moment, I don't get any syntax errors, but nothing happens, so I presume I have referred to it incorrectly.
View 2 Replies
Feb 24, 2010
Is it possible to refer to a variable in a class file separate from the one you are working in? Say Class1.as had a variable named "exampleVar", and in Class2.as you wanted to put something like "exampleVar++;". Is this possible and if so how would it be achieved?
View 1 Replies
Mar 21, 2012
I am in the end of my development of a script that parses out large amounts of data from the timeline with AS3. This data is then used for an animation in corona. We have several of animations in the timeline, and we are splitting those by frame labels. That means that all objects are in place and often, there is no use of them and those movieclips is missing keyframes. My script parses out everything, but I just want the data thats has some value.
detect if a current frame in a layer is a keyframe or not? If not, get rid of data that we are not animating.
View 1 Replies
Jan 12, 2010
I'm trying to make a menusystem that will jump to specific frames depending on what frame I'm currently on. I have made a switch/case to evaluate the current frame. I have managed to find this code to get the current frame but I need an instance of my entire flash movie it seems? I have tried this (psudo code sort of). var frame = myClip.currentFrame; I then proceed to test frame in the switch/case statement. (All this is an event for a mouse event listener BTW). Now how can I refer to myClip?
View 1 Replies
Jan 20, 2006
i'm trying to make a transition, but unfortunatelly cannot make it work! it does not jump from the _root frame to the one i indicate, simply repeats the movie in that frame everytime i press the buttons! here are my actions on the buttons:
[Code]....
View 3 Replies
Jun 15, 2008
I need some help with some variable problems. (AS2)
Code:
if (_root.Block+blockUpOne.dead == false) {
surroundingBlocks++;
}
I'm targeting a duplicated mc from another duplicated mc. The 'blockUpOne' is the variable of the number on the end of the duplicated mc (the "i" variable when the mc was created 20, the amount of blocks in the grid across). Basically I'm trying to target a block on top of the one with the code on. I need to add the blockOneUp variable to the _root.Block to made a string which targets a duplicated mc above the one with the code. Even more basically, I want to target an mc by adding a variable to the targeting code.
Example:
Block above: Block34
Block with code: Block54
if(_root.Block+(54-20) is alive){
do stuff
}
View 9 Replies
Apr 8, 2010
I want to edit a variable in _root from a function
it should look like this:
Code:
var index:number = 0;
function fnct (root_counter){
[Code]....
View 3 Replies
Jul 26, 2010
I am making a frame by frame animation, where I draw a character, make a new frame and use the onion skin to slightly move my character. Is there a way to make a certain part faster than others? I made a character prepare to kick someone, but since i was doing it frame by frame it looks slow. So instead of taking out frames and making it look choppy, how do I make a certain part faster or increase its FPS? I tried making a new scene and changing its FPS, but that still changes the overall FPS.
View 6 Replies
Sep 23, 2008
I want to to have 3 x 3 Frame Keyframe animations (very simple) with a title keyframe in between each one. What I am struggling with is that instead of repeating the keyframes lots of times and having a huge project I want to repeat each 2 Keyframe animation 30 times (making it a minute long) before moving onto the text keyframe and then the next 2 keyframe animation to loop 30 times before moving on... I then want the whole thing to loop.
What code do you use in Flash CS3 (ActionScrpit 3.0) to acheive this for each set of keyframes? To keep it simple they are all one one layer.
View 1 Replies
May 28, 2007
Just wondering how this is done within an "if then" statement. I need a code like
if (_root.frame = "home") then {
this.quickHome.onPress = function () {
_root.gotoAndPlay ("homeToContact");
}
}
I know the first line isn't going to work, but just wondering if someone knew of a code that would?
View 2 Replies
Jul 15, 2009
I was following a tutorial and input the AS code :
_root.onEnterFrame = function(){
if(_root._xmouse<50){
imgBar.prevFrame();
}
}
and im getting this : ReferenceError: Error #1065: Variable _root is not defined.
at Sliding_fla::MainTimeline/Sliding_fla::frame1()
View 7 Replies
Jun 12, 2009
How do you create a motion tween when I insert keyframe in frame 28 then I click on the object and create motion tween but when i click in 60 to insert keyframe I get opition of position, scale, skew, rotate ect. I just want to insert keyframe. What am I doing wrong?
View 4 Replies
Apr 24, 2004
I need to a keyframe to pause (for say 20 seconds) when the frame is entered (i.e. not a button press, etc). After the 20 seconds is up, i need the timeline to continue playing to the next keyframe. I've searched and searched for setinterval and the like, but i could not find a clear answer.
View 14 Replies
May 4, 2009
my name is fabo i made a flash game and i need help with this script:
score = 0;
var Seconds = 10;
function timer():Void {
_root.Seconds -= 1;
}
setInterval(timer,1000);
if (_root.time == 0) {
_root.gotoAndPlay(4);
}
stop();
where it say: _root.gotoAndPlay(4) it won't go to the frame after the score counter hits
View 12 Replies
Mar 9, 2005
I know this is simple but I can't find a tute on determining the y mouse position. I'm sure I saw something in the AS Dictionary but I just can't find it now.All I'm trying to do is have the _root mc goto frame 3 when the user's _ymouse is <= 60px.I was going to put my AS attempt here but it's so out of wack I thought I'd be laughed out of math class.
View 9 Replies
Jan 14, 2010
In the code below i want to change the _root.broj and _root.logo variables inside the function which returns values from .php file. Inside the function everything works fine and all values are correct but when i trace var broj outside the function it's still 0.
var result_lv:LoadVars = new LoadVars();
var send_lv:LoadVars = new LoadVars();
var broj:Number=0;
var logo = new Array();
[Code].....
View 1 Replies
Mar 7, 2004
What I want to have happen is when you mouse down on the button/MC the block_mc will first jump to frame 40 and then it needs to check and stop when the block_mc reaches frame 12. I have attached a simplified version of what I was trying to do
View 5 Replies
Mar 7, 2004
What I want to have happen is when you mouse down on the button/MC the block_mc will first jump to frame 40 and then it needs to check and stop when the block_mc reaches frame 12. I have attached a simplified version of what I was trying to do
View 5 Replies
Feb 27, 2003
im lookin to make this so that the points taken from the _root.cargo are multipled by 10 and added to _root.totalscore
[Code]...
View 2 Replies
Mar 15, 2012
I have a simple flash that has 2 layers 2 images. one image is on the first frame and the other image is on the second keyframe. Actionscript starts on 1st keyframe. What I have it doing is loading frame one stop() reads the actionscript checks the date if the date is met it goes and stops on frame 2 and plays other image:
Everytime the flash refreshes it plays frame one then jumps to frame 2 if the date is met. How do I avoid playing frame one if the date is met what it's doing is playing the first image before the date change and a split second after it plays frame 2. (you see a hiccup)
i need the flash to "preload, check the actionscript before it loads if the date is met automataclly go to frame 2 avoiding frame one all together.
actionscript used on frame one:
stop();
var year:Number = 2012;
var month:Number = 3;
var day:Number = 22;
[Code].....
View 1 Replies