ActionScript 2.0 :: Access Variable After AttachMovie?
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
Similar Posts:
May 4, 2007
I'm currently attempting to build my first classes in AS2 (with high hopes to soon move to AS3..baby steps). I have run into a problem that has cost me the last few hours of the night tonight and I still feel like I'm no closer to the solution >_<
The scenario: I am attempting to create a couple classes that work together to handle the creation of textFields and the methods by which to scroll them (if needed). One class method creates the TextField, populates it, then calls the next class that attaches and sets up the scrolling components/methods if needed.
The problem: I cant access items in my library from my class no matter which way I slice it. I need to attach movieClips from the library to act as my scroll components and am currently attempting to do so by passing the linkageIDs through the constructor. Tracing the items passed through works fine, but attempting to use attachMovie with them (or with the ID's as literal Strings) fails silently; nothing gets attached.
View 4 Replies
Sep 11, 2009
What I'm trying to do is simply this:
<variable> = mvcShip
var ship1 = _root.attachMovie( <variable>, shipName + _root.getNextHighestDepth(), _root.getNextHighestDepth() );
What i am trying to attempt here is to make the variable equal to the name of an item in my library. (Im using this to use different ships in an old arcade-style vertical shooter). This is meant to make a ship appear on stage.
When <variable> is replaced with a library item (eg. mvcShip), it works fine, but if the variable is in place, i get a trace value of ship1 as "undefined", and the ship doesnt show up on the stage.
View 9 Replies
Aug 8, 2007
I'm trying to use attachMovie with a variable - so that the attached linkId is dynamic.
Kinda like this
[Code]...
View 1 Replies
Jan 31, 2008
I am trying to write an attachMovie statement with a variable feeding the ID parameter.[code]...
View 1 Replies
Jul 24, 2009
All I need to know is how to set the idName to attach in attachMovie to the value of a variable?The linkages are fine, the problem is just being able to specify a different clip to load depending on what a certain variable is set to.I don't have the FLA with me right now..OK, say I have a variable with the string, '00'. When this code runs, I want it to load the clip with the linkage, '00'. Say the variable's string changes to '-10'. Then when the code runs, it should load the clip with the linkage '-10'.If this isn't possible, or there is a better way...I'm working on a game. I want it to attach a different level to the stage depending on what value a 2 variables are, but I keep getting Type Mismatch, or it doesn't work.[code]The current linkages are 00 (0x, 0y), and -10 (-1x, 0y). They are comprised of 2 variables, the first one is xmap, and the second is ymap. I want to be able to combine the 2 variables and then attach the clip with that linkage to the stage..
View 4 Replies
Aug 12, 2007
I am creating movie clips with a for loop using attachMovie, I would like to pass a variable into the clip itself at the time of it's creation. It seems simple enough, but my little brain is imploding...
So basically I got an MC: "clip"+i, which I would like to pass a variable (from an array), for it to use on it's own timeline. I want the next clip to be able to use the next variable in the array in it's own timeline.
View 1 Replies
Mar 23, 2010
I've frequently used variable names for the target but is it impossible to do this:[code]I can't get it to work and I haven't been able to find an example.It doesn't work without the square brackets either.
View 6 Replies
Aug 13, 2008
I have a script which places a clip on the stage (well, just off it), and rotates the clip and then tweens it to a certain x/y coordinate based on the rotation using TweenLite, and all of this on a setInterval of 2 milliseconds. That works well. Thing is, I don't seem to be able to set a unique name based on the clipname and an incrementing number. Basically (and this isn't the whole thing, this is just the general idea), it goes:
Code:
interval = setinterval("dothis", 2);
var increment=0;
function dothis(){
attachMovie(movieICall, "movieICall" + increment; 1)
movieICall._x = ;
_y= etc;
increment++;
}
So when I set the interval to 2 seconds, it moves everything well and there are no problems. When I set the interval to 2 milliseconds, the clips only get just onto the screen before disappearing. I've tried creating a function to handle the x,y, tween. So I could refer to the clip with a "this", but it doesn't change anything. The only thing I can think of is that movieICall is not incrementing, and every clip on the screen is being referred to as movieICall, in which case the next case of x, y, tweening overwrites that last one and effectively kills the last one (but then why is it not just left sitting on the screen)? I tried adding an overwrite: false to the end of the TweenLite, but that only let the tween happen once and then...nothing.
View 1 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
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
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
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
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