ActionScript 2.0 :: Access Variable Value In Other Layers ?
Oct 18, 2010
i'm making a menu with flash cs5 using actionscript 2.0 for my game that can be use scaleform menu made it with flash, i have a little problem.
i have a layer called "action" in my timeline where is a function that receives from my game a variable value (slot) that indicates to the player if the slot is available to save a game or not.
i have another layer called "newgame", where are some controls, pictures and movie clips, when the player click on the marker in this layer, i need to load the "slot" variable from the layer called "action" to let the player save or not save the game, but i can figure out on how to get the value for the slot variable from the Action's layer.
i have tried with this:
Code:
stage.actions.slot1;
stage.slot1;
_parent.actions.slot1;
[code]....
View 5 Replies
Similar Posts:
Jan 10, 2011
I have a movieclip and in it/on it I have a few layers. 1 layer is for buildings and 1 layer is for props. When i add/sort specific objects to an array from this main movieclip only objects in the top layer are added. What is up with that? How do I let the array access all layers of the movieclip?
View 1 Replies
Jun 28, 2011
I have 2-3 layers in my movie clip and i wanto access them using ActionScript code. I want to show hide and access Elemts(buttons, text box) in that layer.
So how can i do that using ActionScript-3
View 2 Replies
Sep 8, 2006
How do you set a variable so that other layers can retrieve that variable.
PHP Code:
nick.onPress = function (){
set.my_txt = "nick";
gotoAndPlay(2);
trace(get.my_txt); // This does return "nick"};
// Then in another layer after the animation :trace(get.my_txt);
// this returns undefinedmaintextarea.text = get.my_txt + "'s Portfolio";
View 10 Replies
Dec 2, 2010
I got a variable "VideoFolder" well defined in my root level. However when I used this variable directly in child layers, my script does not recognize it and I get error 1120: Access of undefined property VideoFolder. I tried changing VideoFolder with _root.VideoFolder in all my child layers scripts, but it changes nothing.
View 2 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
Sep 10, 2005
the snow effect always acts like the top layer, ok what i mean is, i have 3 layers, (1)toplayer= a car, (2)middle= snow, (3)low= background.I want to make the snow to be seen behind the car...i hope you understand what i mean , whenever i put the code from the link above it acts as the top layer and appears in front of everything.
View 4 Replies
Aug 17, 2009
How can I access the member variable of an object by using a variable in the name.Example:
Entries Object has properties 1, 2, 3, 4, 5.
Normally I would access them by
var i : int = Entries.1;
[code].....
View 1 Replies
Oct 22, 2008
Is it possible to add layers, re-order layers, move movieclips from layer to layer or specify which layer a duplicate movieclip appears on at runtime with AS3?I am aware of the depth properties and the functions associated with that but it would be easier to have a concept of a layer because I am dealing with masks.I have a nasty feeling I'm gonna be told that layers don't really exist within an swf and that depths and setmask are all there is to work with.
View 4 Replies
Jul 18, 2009
i'd like to access a variable in an associated class from my Document class [code]in my document class im trying to see if the class has changed the variable... if it has changed i'd like to obviously do something.if this isn't possible what's the simplest way to check a variable in another class?
View 3 Replies
Feb 3, 2010
I have a button inside a MovieClip (instance name: bt_fechar) and I want to refer to it from the main timeline (that's where I want to keep most of the code). It returns the following output error message: "Error #1065: Variable bt_fechar is not defined"
Heres the code:
function retirarCiclo(event:MouseEvent):void
{
[code].....
View 1 Replies
Dec 8, 2009
ActionScript Code:
package {
import flash.display.Sprite;
[code]......
View 7 Replies
Aug 24, 2009
I have an SWF file that loads another SWF file dynamically.
I've managed to make the parent SWF receive a variable from the php page that loads it, via javascript, it works well [code]...
View 1 Replies
Mar 2, 2010
I have an xml parser that i tried to code into an external class/package.I have no experience with packages so its been difficult but i got most of the way there.The code works, the problem is that i dont know how to access the output variable from the package in my fla file.How can i use the variable allText in my fla?
package
Code:
package {
import flash.events.*;
import flash.display.Sprite;
import flash.net.URLRequest;
[code]...
View 4 Replies
Apr 11, 2010
How to access a local variable from another class? I have this powerup class that changes the speed value of the enemy in enemy class(it's a game). For instance, if player hits the powerup it changes the local variable 'speed's value inside enemy class.
View 3 Replies
Sep 14, 2010
On the first frame I have a string variable called "nextSection". When the user clicks on a menu item on the site then "nextSection" is populated with the name of that section. Later on in the fla I have a movieclip containing various sections for the site. The swf compiles without any problems.
I'm now attempting to make the file smaller and easier to update. Rather than have 8 different movieclips that load images, I thought I would just have the one. I changed the following lines in my fla
PHP Code:
// nested within 2 movie clips (sections.aboutUs)loadImage("aboutUs/mainImage.jpg");//nested within 2 movie clips (sections.outdoorAdvertising)loadImage("outdoorAdvertising/mainImage.jpg");// there are 8 of these in total.
[code]...
I'm now getting the error "1120: access of undefined property nextSection". The variable does not contain anything when the file compiles. Only when the user clicks on a menu item does the variable get filled (ie: if user clicks on the OutDoor Advertising button, the variable contains the string "outdoorAdvertising" which is also a folder in the site directory). I tried to populate it with the name of one of the sections on the first frame ( ie: nextSection:String="aboutUs"; ) just to see if it worked but still got the error.
View 8 Replies
Jan 17, 2009
i have variable a=0 and i want a movieclip that runs to change it to 2, what do i write in the movieclip code ? i tried parent.a=2 but it's error.
View 4 Replies
Apr 17, 2010
I have a MovieClip who's added on stage by code.I would like to access to rond2(which are an instance of rond on frame 10) but one error appeared like you can see.This the code that i've maked on first frame on the scene:
var monCarre:MovieClip = new mv_carres();monCarre.addEventListener(Event.ADDED_TO_STAGE, leDire);
addChild(monCarre);monCarre.x=275;monCarre.y=200;//monCarre.rond2.alpha=0; <<<<L'éxécution de cette ligne provoque une erreur
function leDire(e:Event):void{ trace("monCarre est ajouté");}
View 3 Replies
Nov 27, 2011
Normally, I declare a variable at the very top of all my code like, var myObj: Myobj = new Myobj();...
but for some reason the the new variable being declared is necessary to present within the function, like displaying same objects in the library using for loop.
I notice that variable declare within a function will not be accessible outside the function or from another event handler or from another function....
I have seen code that make it possible my declaring a new variable?
View 4 Replies
Dec 9, 2010
I have a class with a var textFieldObjets:Textfield in my class environment. What I'd like to do, is access this var from another class and change the text. I tried things like
environment.textFieldObjets.text = ".....";
Got error 1119, Access of a possible undefined property textFieldObjets trough a reference with static type Class.
I can't even access my environment class...
View 2 Replies
Apr 19, 2011
I have to access jsp variable in mxml file... or how to access jsp variable in java file...
View 1 Replies
Jun 17, 2009
I have 2 classes: A Main.as and XmlLoader.as. In Main.as I now want to access a variable of a XmlLoader-instance, which has been changed in run-time by a Event.COMPLETE EventListener.To make things clearer here some code:
Code:
Main.as:
package {
import flash.display.*;
[code]....
in Main.as I want to trace (trace(_xmlData._xml)) the xml file which is loaded.
View 0 Replies
Jul 29, 2009
function fn1(var2)
{
//here i want to trace the name of var1....ie output: "var1"
}
fn1(var1);
how to trace the variable name i am passing to fn1 (ie. var1) as string?
ie. output shoud be
"var1"
ie i want to trace the name of argument variable i am passing
View 0 Replies
Aug 12, 2009
[code]...
I keep on getting the output "undefined" everytime trace was called.
View 2 Replies
Jan 28, 2010
function loadHandler only runs one time .. since it runs only once it makes it very difficult for me to do anything with.I can only access the variable "myClip" inside of the function.... if I could access it outside of the function I would be able to write some if statements.Basically what I am trying to do ... is the first time this script runs ... I don't want "myClip.gotoAndPlay(2);" to run. Every other time this frame of code runs .. it wont run the function a second time. So I need to somehow tell it every time it runs after the first time to run the code myClip.gotoAndPlay(2);
View 9 Replies
Feb 10, 2010
I have a class file by name [code]...
i have written this following code to be able to access the previous class, but even though the value of the wrongclick isnt 0, i always get teh value as 0.[code]...
View 1 Replies
Mar 15, 2010
I am trying to access a text object inside an MC inside a variable (with a corresponding Symbol name) after dynamically attaching an MC. the code that sets the "dockTemplate" variable is below. I'm trying to write to the "item" property called "label" on a rollover function called "dockRolls".
var dockTemplate = {
layout: 0
icon_size: 80,
icon_min: 50,
[Code].....
externally, there is another AS file that extends the MovieClip class which is setting up the functions, etc. in 'var dockTemplate'. that seems to be working fine. my question is:
HOW do I write to/access the text object 'orderEntry_txt' inside 'dockTemplate'?
View 0 Replies
May 29, 2010
I have a button in the frame 1 when i clicked it,it goes to the nextframe in nextframe i have movie clip named "circle". in frame 1 in action layer i have variable named "i" it has a number equal 20; now i'm in "circle" movieclip in the action layer i want to write a command for checking "i" if it's equal 20 the "circle" movieclip play but i can't find "i" how can i access to "i" variable in frame 1 ?
View 4 Replies
Jan 14, 2011
I've done a pretty thorough search but I can't really find an answer to what I believe must be a common question. I have a simple variable defined in my Main class that loads an mp3. I'd like to be able to turn off the mp3 from within another class. Obviously, in order to do so, I need to be able to access that variable. How can one class "talk" to another? Or more specifically, how can I access a variable in my Main class to use in another class?
View 9 Replies
Jan 11, 2012
So ive made a custom message system for my game and the scrollpane component requires me to have the info inside one movieclip. I have a couple of textfields there that i want to change to some variables on demand. The vars are in an external as file and im able to reference them well on the main timeline. The problem is when im inside the scrollable object, all the vars return blank instead. This is the code which is placed inside the object:
Code:
import Variables;
var variables:Variables = new Variables();
function setMsgSlot (e:Event) {
[Code]....
View 0 Replies