ActionScript 2.0 :: Referencing Objects From Inside A Function?

Jun 18, 2011

I understand this, _parent keywords and its usage but I don't understand the following:

MovieClip.prototype.move = function() {
function toRight() {
this._x=50;

[code].....

View 3 Replies


Similar Posts:


Referencing A PHP String Inside A Function?

Feb 21, 2009

I am currently connecting to a PHP string in actionscript. While I'm having no trouble importing the variables like so:

Code:

this(variable);

I am having trouble referencing the same variable while inside a function:

Code:

_root.ButtonMovie.onRelease = function() {
this(variable);
}

I really need to reference the variable while INSIDE the onRelease function, because I need to apply some actions based on how many times the button has been pressed.

View 2 Replies

ActionScript 2.0 :: Referencing Objects Not On Same Layer

Jul 15, 2011

Is it possible to control an object/element on a instance? If so, how is it done through actionscript?

There is an instance "instance140" off of the root, that has an element named img4 that i need to reference... does anyone know how I would go about that?

View 1 Replies

ActionScript 3.0 :: Referencing Objects In Array?

Feb 25, 2010

I've created a for loop to do the following:add instances of button MovieClip from library to stagename the instances via name propertyadd instance names to array for later referenceadd event listenershese 4 steps are working peachy, however, I'm having troubles referencing these instances later on through my code. I'm pretty sure that the problem is in my data types not matching, but I'm not sure how to fix it.

var menuBtn:mc_menuBtn;var menuBtnList:Array = new Array();
for(var b:int = 0; b < numFiles; b++){  //add instances to stage  menuBtn = new mc_menuBtn();  testClip.addChild(menuBtn); //adding button instances to

[code].....

View 5 Replies

ActionScript 3.0 :: Referencing Objects In Captivate?

Jul 6, 2009

I need to be able to dynamically position a component generated in Captivate 4 via ActionScript that in child SWF that is imported into the Captivate project. The problem is that I don't know how to reference the objects in the parent movie. I can set a label on the object and reference the parent itself with:

MovieClip(this.parent)

but this doesn't seem to work:

MovieClip(this.parent).label.y

And I suspect that it is because some how Captivate subclasses the objects but I'm having trouble finding out how the hierarchy is structured.

View 2 Replies

ActionScript 2.0 :: Referencing Objects By Variable Name

Jan 11, 2007

I have a simple function that dynamically creates text fields. My text field name is referenced by var thisTextField. Problem is, when I try to do things with my text field, actionscript shoots back an error as such: There is no property with the name 'text'. How am I supposed to apply properties to my object if my objects name is a variable?

Code:
function showProducts() {
var products:Number = 0;
var thisTextField:String = "product" + products + "_txt";
for (var itemID in _global.rtsData[_global.rtsPos]["products"]) {
[Code] .....

View 2 Replies

ActionScript 3.0 :: Referencing Stage Objects From Within Class

Sep 3, 2009

How to access stage elements from within a class.
buttonControls.as

Code:
package {
import flash.display.Sprite;
public class buttonControls extends Sprite {
// Navigation Hover Color
var hover = "0xF1E960";
var normal = "0xFFFFFF";
public function changeColor(object, color){
[Code] .....

View 2 Replies

ActionScript 3.0 :: Referencing Objects That Are Not Present On Frame 1 Of A Movieclip

Apr 20, 2010

I'm working with a movieclip right now that has two frames in it. I want the user to be able to go back and forth between the pages by clicking on tabs on either page. The button that they click on is only present on the frame that it is applicable (so, the button to switch to frame 2 is only present on frame 1, and vice versa).

I want to control when they are able to click back and forth, and be able to turn the buttons on and off whenever I need to, but since the button to switch back to frame 1 is only on frame 2, when I reference it from the main timeline, the button registers as a null object. How do I refrence an object that is not present on the first frame of a clip?

[Code]....

View 3 Replies

ActionScript 3.0 :: Referencing Variables/objects From External FLA Files?

Dec 1, 2010

I am trying to display in 'Reciever.swf' the value a shared object updated in 'TextSO.swf'. The following is my code for the Reciever

Reciever.as-----------------
package {
import flash.events.SyncEvent; import flash.events.NetStatusEvent; import flash.events.MouseEvent; import flash.net.SharedObject; import

[Code]....

I am getting an error that says that 'text_so' is an undefined property and that I can't access it. Yes, I have not declared 'text_so' in 'Reciever.as'. However it is the shared object instance from the 'Text_SO.as' file. How do I reference it from the 'Reciever.as' so that I won't get this error anymore?

View 1 Replies

ActionScript 3.0 :: Referencing Objects In The Level Above The Movie Clip?

Sep 10, 2011

i want to referance objects in the level above the movie clip that i have the AS in.  what i mean is that i have a movie clip on the stage, and that movie clip has some actionscript in it, and that AS needs to refer to an object on the main stage, how would i do that?  i have tried parent and stage 1, but neither seem to work

View 4 Replies

ActionScript 3.0 :: Referencing Variables / Objects From External FLA Files?

Dec 1, 2010

I am trying to display in 'Reciever.swf' the value a shared object updated in 'TextSO.swf' . The following is my code for the Reciever[code].,...

I am getting an error that says that 'text_so' is an undefined property and that I can't access it. Yes, I have not declared 'text_so' in 'Reciever.as'. However it is the shared object instance from the 'Text_SO.as' file. How do I reference it from the 'Reciever.as' so that I won't get this error anymore?

View 4 Replies

ActionScript 3.0 :: Dynamically Referencing Objects Names In Loop

Jul 12, 2009

The problem is referencing object names dynamically in AS3, in a loop. Example. I have an array called c4 which i would like to reference like this:

I have a number
var x:Number = 4

How can I do something like
trace(["c"+x].length);
(I know this is wrong!)

Same with other objects
E.g. Movieclip called mc4
["mc"+x].x = 100;

View 3 Replies

ActionScript 3.0 :: Referencing An Object Inside A Class

Feb 1, 2009

and I'm trying to add an event listener and a function to the class, but I keep getting errors of undefined, I tried just about everthing to be able to refference obj0

objGroup.obj0.addEventListener(MouseEvent.CLICK, onClick)
private function onClick (event:MouseEvent):void{
trace ("Click");
}

View 17 Replies

ActionScript 2.0 :: Variable Referencing Inside Loops?

Apr 27, 2010

ActionScript Code:
function setUpButtons() {
var btnCnt = numeri_array.length;
for (i=0; i<btnCnt; i++) {

[code]...

i'm having a problem with this script... the onRollOver and onRollOut are working properly but the onRelease it's always the same i mean (my_mc.loadClip(foto[27], "container") for all the 27 buttons..

ActionScript Code:
for (i=0; i<btnCnt; i++) {
var temp = this["a"+i];

[code]....

and everytime i have to make a modify i have to write for every case..

View 2 Replies

Actionscript 3.0 :: Referencing Movieclips Inside An Array?

Dec 16, 2010

I am trying to reference a movieclip located inside an array to add an eventlistener and function... I am using array[0].add...ect. The code for the first movie clip works, but for the rest I get an error 1010.

Code: Select allvar image:MovieClip = new Image();
addChild(image);
const MAX_ITEMS:uint = 6;

[code].....

View 1 Replies

ActionScript 3.0 :: Object Oriented Game - Referencing Dynamic Objects

Jun 26, 2009

I'm doing this object oriented game and I create a bunch of 'boxes' via a for loop

Code:
Select allfor (var z=0; z < numOfBoxes; z++){
var box:Object = new Object();
box.mc = new Box();
box.mc.name = "box"+z
box.mc.x = Math.round((Math.random()*(530-box.mc.width)) + 20);
for (var i=0; i<boxXArray.length; i++){
[Code] .....

I get my random amount of boxes scattered over my stage (I haven't put in any checks to see if they are touching). How do I 'name' these boxes so I can reference them later? Say I want to move the .x of boxA in another function? Is there a simple way to call them box+z instead of just all as box? (Then I can run them through a loop later to talk to them).

View 2 Replies

ActionScript 2.0 :: Aligning Variable Sized Objects And Objects Inside Them

Jun 29, 2006

How do I align a movieclip, which width and height is user-defined, inside another object (this one is static, though). Top-left alignment is easy, x=0 and y=0, but what about center, center left, bottom left, etc? Math(.round) i suppose, but how?I want an object (static) inside the movieclip (user-defined) to stay aligned to, for instance, the top right corner, similiar to the minimize, maximize and close buttons at the top right of your browser.. The height and width data is pre-defined by the user in another file.But that does probably not make any difference...

View 3 Replies

ActionScript 3.0 :: Referencing A TextField Inside Object On DisplayList

Nov 20, 2009

I have a bunch of objects with TextFields in them that are added to another object called Field.[code]If it is a player, and I can scale it, why can't I access the textField?

View 1 Replies

ActionScript 2.0 :: Referencing A Text Field Inside A Movieclip?

Feb 2, 2011

I am trying to enter a student name into a textfield (student1_txt). I just can't seem to work out the correct syntax. The student numbers and names are in an array. I have the fields working fine outside of the movie clip but not inside.

I wonder if anyone can see what is wrong in the statement below:

_root.desk1_mc["student"+heidedata[0]+"_txt"].text = myStudents[0];

View 8 Replies

ActionScript 3.0 :: Referencing A Button On Main Stage From Inside A Movieclip?

Nov 22, 2009

On the main stage I have a button that I have made invisible once the file is loaded.  Inside a movieclip I have on frame 15 the following actionscript 3 code
 
button_mc.visible = true;
 
I want the button to become visible at the end of this movieclip.  I am not using an external as3 file, I am putting the as3 code in its own layer on the first frame.
 
I know it has something to do with the path to the button, but I cannot figure it out.  If there is anyone who can point me in the right direction for referencing instances by instance name that reside on the main satge from inside a movieclip

View 3 Replies

ActionScript 3.0 :: Referencing Variable Result Inside Speech Marks?

Jan 1, 2010

How would I go about refferencing a variable and then turning it into a string (if that is the correct terminology). e.g:

[Code]...

I need the result of variable something to end up inside the speech marks without loosing its obvious refference to the variable.

View 2 Replies

IDE :: Referencing A Global Var Within A Function

Apr 18, 2009

I'm an old C programmer been away from programming for years. Now we have a project requiring Flash and I've been elected. Just installed CS4. I have 16 panels in 4 sets of 4 that rotate left to right. (Big learning curve on that one - fading transitions in the right order...). Each panel must have a unique url when clicked. (16 urls).I've looked through many solutions, most of which seem unduly complex. I think that the simplest short of going to onRelease() with AS2 (Later I have to add mouseover changes in the graphics) is something like this:[code]I haven't found this solution out there. Is there a gotcha because the a#Link vars are accessed as global within the scope of handleLink? It doesn't feel right, but it works fine and 16 global variables doesn't seem too bad.

View 2 Replies

ActionScript 3.0 :: Referencing A MovieClip In It's Function

Aug 28, 2010

i was wondering how i would access the desired movieclip's x, and y value from it's function.[code]HOW do i access the x and y values of MC from here
like you would use "this._x" in AS2, how would i do that here?

View 1 Replies

ActionScript 3.0 :: Referencing Function With If Statement Not Working?

Jan 10, 2005

I am trying to reference a function in an if statement and it's not doing anything. The reference is here.

Code:
private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);

[code].....

View 1 Replies

ActionScript 3.0 :: Referencing Movieclip Created In Another Function?

Oct 14, 2009

wrote a couple of small games using AS 2.0. One of the things I found easiest about AS 2.0 is that a MovieClip created using _root. attachMovieClip() inside of one function was accessible to every other function. For instance:

Code:

function AddClip() {
TheClip = _root.attachMovie("Object", "TheClip"+ClipCount, _root.getNextHighestDepth(), {_x:30, _y:30})
}[code]....

This causes an error, because the MovieClip variable was declared inside of a function and when the function ended, the MovieClip variable was erased. Is there any way of doing this without declaring the MovieClip variable outside of the function? I want to be able to create an unknown amount of these movieclips on the fly, so I can't just declare them outside of the function.

View 9 Replies

ActionScript 3.0 :: Referencing Function With If Statement Not Working

Apr 30, 2010

I am trying to reference a function in an if statement and it's not doing anything. The reference is here.

Code:

private function newNumber (qTotal:Number, curNum:Number):Number {
var newNum:Number = Math.floor(Math.random()*qTotal);
for (var j:Number=0; j<curNum; j++) {

[Code]....

View 5 Replies

ActionScript 3.0 :: Passing Parameters Through Dynamic Function Referencing

Jan 1, 2012

I'm making a function, and I want to pass it's handling less restrictively, kinda like jQuery I guess.

Code:
function cfunc(min, max)
{
return (Math.floor(Math.random()*(max-min))+min);

[Code]....

Now I know that alternately, I could pass them individually to the function and then join them all together as one, but I'd prefer to use one variable and pass the data through it, kinda like a scripting engine.

View 1 Replies

ActionScript 3.0 :: Remove Event Listener Without Actually Referencing Actual Function Name?

Dec 30, 2009

I've got a button that i dynamically add different event listeners to. Anyone know how to remove an event listener without actually referencing an actual function name?

View 2 Replies

ActionScript 2.0 :: Adding Properties And Events To MovieClips Inside A Loop Inside A Function

Dec 8, 2009

I have done this same thing in ActionScript 3, but am not familiar with ActionScript 2, which I am forced to use for this project. I am loading products into a SWF via XML and attempting to add a click event to each dynamically-created movieclip. Simply tracing the text from a node in XML will do for now. I'd like to assign a property called "desc" or "description" to each movieclip and have it trace that property's value when clicked. Here is the relevant portion of my code as it stands:

ActionScript Code:
var iXML:XML = new XML();
iXML.ignoreWhite = true;

[Code].....

View 6 Replies

ActionScript 1/2 :: Referencing _root.Button  From A Movie Loaded Inside Another Movie?

Oct 18, 2009

MainMove.swf is doing a loadmovie of SecondMovie.swfThe Button that loads SecondMovie.swf also disables other buttons in MainMovie.swfon (release) {  _root.intro_btn.enabled = flase;  loadMovieNum("SecondMovie.swf", 2);How do I Re enabled the Buttons in MainMovie.swf from a Button within SecondMovie.swf???

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved