ActionScript 2.0 :: Accessing Variables Inside Other Movieclips.?

Nov 22, 2004

I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...The situation is a random number of sprites are created, and they move around the stage, interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Accessing Variables Inside Other Movieclips?

Nov 22, 2004

I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...I still have a bunch to learn, but I wanted to go ahead and ask a question for a problem I am having right now.The situation is a random number of sprites are created, and they move around the stage,interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?

View 1 Replies

AS3 :: Accessing Variables Between 'movieclips'

Jun 16, 2008

I have finally started with AS3 and flip-'eck its a different animal that AS2

I have a swf called login.swf and in it have declared the variables var total:uint=0; and loginState:Boolean=false

All my scripts for logging in sending/receiving variable from/to server scripts are all working!

So... when a user supplies a correct password another swf (userLogged.swf) is loaded (note: in AS3 this process is seriously different than in AS2) swf dont seem to be loaded 'into' another movieclip anymore... and this leads me to the puzzle!

How do I access variables declared in the project.swf, from within the userLogged.swf!

the old AS2 way = trace (_root.loginState);

or trace (_root.project.loginState)!

I am stumped by this new approach of AS3 of loading in other swf files. The _root. options is no longer available in AS3 (that much I've descovered, some tuts say use root. but I cannot get that to work)

trace (root.loginState)
or

var userLoggedIn=root.loginState

gives me the error

1119: Access of possibly undefined property loginStatus through a reference with static type flash.displayisplayObject.

when I try to publish the userLogged.swf

View 4 Replies

ActionScript 3.0 :: Accessing MovieClips Inside Custom Class

Oct 1, 2009

After resolving one issue, another error has surfaced in my custom class. This class displays a dialogBox and the dialogBox has some interactive MovieClips like btnOK_mc Button.On creating an object of the said class, it reports errors like "Access of undefined property btnOK_mc".[code]I understand that it is an issue of the Scope of these controls; but don't know, how to define these MCs; so that they look like Public. I may be just out of track on the issue.

View 8 Replies

ActionScript 3.0 :: Accessing Input Fields Inside MovieClips

Jun 17, 2010

I have a couple of Text input fields sitting inside a MovieClip and i am wanting to know how do i go about accessing them from outside the MovieClip and obtaining the value of each input text field?the movieclip is called myinstance the movieclip code is in a value like this public var myinstance: MovieClip = new Ccontrol(); that is for the MovieClip the actual [code]When i do that i get the message the left control is now.when it shud be the left control is A or what ever the user entered in the input field b4 they click on the button savedcontrols.

View 1 Replies

Actionscript 3 :: Accessing Variables Inside Embedded Swf?

Aug 14, 2011

I'm programming an AS3 application where I'm loading an external SWF file to a movie clip in my stage:

var bgLoader:Loader = new Loader();
var bgURL:URLRequest = new URLRequest("file.swf");
bgLoader.load(bgURL);
addChild(bgLoader);

My question is this: how can I read a variable inside the embedded swf (probably through the bgURL, but I can't figure out how)

View 1 Replies

ActionScript 2.0 :: Accessing Variables Inside Functions?

Mar 26, 2010

I'm trying to make a button that gets it's getURL address from an external text file. So, I load the text file and assign it to a variable:

[Code]....

View 5 Replies

ActionScript 2.0 :: Accessing Variables Inside A Loaded .swf

Oct 18, 2003

Ive loaded an swf-file (using mc.loadMovie("the.swf")) into movieClip (mc)

inside of that swf there are some variables that id like to manipulate

how do i access them.

View 1 Replies

ActionScript 3.0 :: Reference Variables Inside Movieclips?

Aug 14, 2009

How can i reference variables inside of movieclips

i've tried.. mcname.variablename but it doesnt work...

also how do access a variable in the main timeline from within a movieclip.. i used to do it through _root.variable but that doesnt work anymore..

and lasty... how do i access a variable inside a class from within a movieclip?

View 1 Replies

ActionScript 3.0 :: Call Stage Variables Inside MovieClips?

Jun 30, 2010

How to call stage variables inside movieClips

View 1 Replies

ActionScript 3.0 :: Accessing Movieclips Within Other Movieclips?

Oct 5, 2008

I am still transfering from AS2 to AS3 and right now i am having a very annoying problem. THE STRUCTURE:
Maintimeline contains 2 buttons that i want to use to access children in a bunch of movieclips. rectangle_mc has circle_mc circle_mc contains xx_mc xx_mc contains wtf_mc placed on frame 1 on maintimeline Why can't flash see my nested movieclips? I remember in AS2 you could go down the line:

[Code]...

View 15 Replies

Flash :: Accessing Movieclips In Movieclips?

Jul 30, 2010

I am starting with AS3 programming icm with Flash Builder 4.I have created a "Main" class which is the initial stage.On this stage there is a movieclip called mcMain.In this mcMain is 4 other movieclips: mcStats1 mcStats2 mcStats3 mcStats4 .How can I access these mcStats1-4 from the code to make them go to another frame?I tried:

var t:MovieClip = MovieClip(getChildByName("mcMain"));
t.getChildByName("mcStats1").gotoAndPlay(3);

But that just keeps giving me null reference errors:TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 4 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 3.0 :: Printing Movieclips With Movieclips Inside?

Sep 15, 2010

Printing an MC is easy enough. But I am having trouble printing an MC which has multiple MCs inside of it. They just don't get printed.
 
I am trying to avoid printAsBitmap.

View 5 Replies

ActionScript 2.0 :: Why Do Movieclips Inside Movieclips Have Different _x And _y Than The Timeline

Oct 30, 2007

why does a MC inside another MC have different _x and _y values than the main timeline?What I am trying to do right now is animate a MC inside another MC then get the main MC holding everything to move where that new MC ended animating at (it's part of a game I'm making.)

I know it's confusing but Flash shows the cursors current X and Y in the info panel, which is the same as the main timeline. Yet inside the movieclip, an x of 76 and a y of 277 on the timeline is -195 and -30.9 (respectively) inside the MC.How do I fix it so I can get the _x and _y values to match up so I can tell the main MC to reposition itself to the new X and Y (of the inside MC)

View 1 Replies

ActionScript 2.0 :: MovieClips Inside Other MovieClips - Detecting All

Mar 27, 2008

I have a movieclip called mapWindow, inside mapWindow are dynamically created movieclips of various sizes. The movieclips inside the mapWindow don't take up the entire space of the mapWindow and thus I use a startDrag on the mapWindow upon detection of a mouse press. The problem is, I don't want the start drag to start if the mouse is detected over any of the child movieclips inside mapWindow.

I have a few ideas of how to proceed, but I'm not sure how to reference all child movieclips of a particular movieclip - or something along those lines.

It would be easy to use the hittest function if I knew how to reference all the movieclips I need to, but alas...

View 1 Replies

IDE :: Accessing Different MovieClips In Array?

Mar 14, 2010

I'm having problems making a loop of different movieClips. I've been able to find info about duplicating the same movieClip but I can't seem to get it to apply to this. This is what I am working with: I have 13 different movieClips of an animated character. They are titled montyDog_mc, montyBear_mc, montyCat_mc, etc. I also have a next and a previous button. What I need to happen is for the movieClip animations to cycle through, one at a time, each time the user clicks the next or previous button. I think I should be creating an array of some sort but I am very confused about how I list the movie clips in an array and apply it to the button.

This is what I have:
montyArray = new Array();
montyBear[0] = "montyBear_mc";
montyBee[1] = "montyBee_mc";
montyCow[2] = "montyCow_mc";
montyDog[3] = "montyDog_mc";
[Code] .....
Am I targeting the movieClips properly?

View 4 Replies

ActionScript 3.0 :: Accessing Movieclips On Different Frames?

Dec 3, 2009

i have a gallery on my root timeline. The gallery is called work_mc. Inside of work_mc I have various buttons. There is a different section on different frames.For example,ALL is on frame one, PRINT is on frame two, motion is on frame three.In the root here is the

Code:
work_mc.urbanthmb_mc.addEventListener(MouseEvent.CLICK, clickHandler);
work_mc.urbanthmb_mc.buttonMode = true;
function clickHandler(event:MouseEvent):void {[code]......

This is targeting the buttons that are on frame 1. How do I get to the buttons that are on frame 3? I tried just using the movieclip names but this doesnt seem to work?

View 0 Replies

ActionScript 3.0 :: Accessing MovieClips In A Different Timeline?

Nov 20, 2010

everyone comes across when switching from AS2 to AS3. I have two movieclips (on the same timeline)- character and walls. on the timeline inside walls, I want to access the x and y coordinates of character. How can this be done without the convenience of _root or _parent?

View 1 Replies

ActionScript 3.0 :: Accessing A Button With MovieClips?

Jul 20, 2011

I have the following code that loads MovieClips to the stage:

ActionScript Code:
var sp:MovieClip = new MovieClip();
addChild(sp);
for (var i:int=1; i<19; i++) {

[code]....

Let's say I have 18 MovieClips and on the 18th MovieClip I have a button that I need to access. How would I do that? The following doesn't work:

ActionScript Code:
sp.bm.Pag18._homeBtn.addEventListener("mouseUp", goHome);

View 5 Replies

ActionScript 3.0 :: Accessing Movieclips On Different Frames

Dec 3, 2009

i have a gallery on my root timeline.The gallery is called work_mc. Inside of work_mc I have various buttons. There is a different section on different frames. For example, ALL is on frame one, PRINT is on frame two, motion is on frame three.[code]This is targeting the buttons that are on frame 1. How do I get to the buttons that are on frame 3? I tried just using the movieclip names but this doesnt seem to work?

View 1 Replies

ActionScript 3.0 :: Accessing Nested Movieclips?

Dec 5, 2009

I have a movie clip (assigned to a class) with several keyframes. Each keyframe consists of another movieclip, which contains an animation and all use the same name. Lastly, several of the animations contain a third movieclip, which is also assigned to a class and also use the same name. I need the first movieclip to speak to the third, unfortunately, it simultaneously tells me that the clips in the second layer (the ones at the keyframes) exist and do not exist. Namely: second layer "does not exist" in that the primary movieclip has only one child: a null. If I add other movieclips to the primary's frames, they also report back as nulls depending on what frame I'm on. I've tested this in several parts of the code, though I suppose it's possible that I managed to pick five equally bad spots. It's just so bizarre I still don't know what to think about it. However, the second layer of named clips are there, but I can only prove it by deliberately breaking the code in hopes of deliberately getting a reference error (by attempting to make the clip private, which isn't allowed given my setup).

View 0 Replies

ActionScript 3.0 :: Accessing Movieclips From Class

Mar 14, 2012

I'm having a lot of trouble understanding a certain thing.I'm creating a child of a symbol in my 'main' class.[code]I have no idea how to access 'player' from a seperate class? I would like to change x and y coords from a seperate class. However when I use code like 'player.x = player.x + 2' i get the error message Line 17 1120: Access of undefined property player.I guess in the most simple words, I do not know how to access symbols or their children from a class that is not the document class.[code]Basically I just am curious as to why I can't simply access these items from another class?

View 2 Replies

ActionScript 1/2 :: Accessing Variables From One .swf From Another .swf?

Sep 14, 2009

I have one .swf file inside a second .swf file. How do I have one .swf access variables from the second?

View 3 Replies

AS3 :: Flash - Accessing PHP Variables Using Without Using OO?

Apr 21, 2011

I have the following PHP file with a variable I am trying to access to place in a dynamic text box on my flash stage.

PHP code:

$returnVars = array();
$returnVars['username'] = "test";
$returnString = http_build_query($returnVars);
//send variables back to Flash

[code].....

The code was adapted from a tutorial using a class. However I do not get on with classes so wont be using any.

View 2 Replies

ActionScript 3.0 :: Accessing Dynamically Created Movieclips

Nov 21, 2008

I have an application that I am adding movieclips to a container movieclip through a for loop and repeatedly calling myClip.addChild(theNewClip). Now I have a dozen clips in my container and it seems like the only way to access the clip is to use the getChildByName() method and cast it into a temporary clip so I can get at the its properties.

Is this the best and/or only way to do this? Does the old AS2 myContainer["theName"].property not work with dynamically created movieclips? It doesn't seem to work for me anymore.

access a dynamically created movie clip.

View 1 Replies

ActionScript 3.0 :: Accessing Dynamically Created Movieclips?

Nov 21, 2008

I have an application that I am adding movieclips to a container movieclip through a for loop and repeatedly calling myClip.addChild(theNewClip). Now I have a dozen clips in my container and it seems like the only way to access the clip is to use the getChildByName() method and cast it into a temporary clip so I can get at the its properties.

Is this the best and/or only way to do this? Does the old AS2 myContainer["theName"].property not work with dynamically created movieclips? It doesn't seem to work for me anymore.

access a dynamically created movie clip.

View 1 Replies

ActionScript 3.0 :: Naming And Accessing Dynamic MovieClips

Sep 26, 2009

I'm trying to dynamicly create movieclips that I can drag and drop. Here's what I'm trying to reproduce dynamically: (I placed 2 movieclips on my stage and named them mandible_mc and vertibral_mc)

mandible_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);mandible_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);vertibral_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);vertibral_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
[Code] .....

Here's what's happening:
Unless I have actually placed two movieclips on the stage and named them mandible_mc and vertibral_mc, I get an error. If I DO have those to movieclips on the stage, I get no error and I get my instances of "name_box". But, I can't drag them. I CAN drag and drop instances of mandible_mc and vertibral_mc so I know the addEventListener and buttonMode "thingys" are being created.

View 7 Replies

Flex - Accessing Child MovieClips FlashDevelop?

Feb 17, 2010

I have a movieClip within another MovieClip. I gave the child movieClip the instance name "hSprite" and I added it to the parent movieClip stage. Now I get an error like the following.

[Fault] exception, information=ReferenceError: Error #1056: Cannot create property hSprite on com.objects.Hero. If I remove the instance name from the child movieclip, then the error goes away. but when I add the instance name back, the error reappears again.

Keep in mind that both classes are set for export. The parent class is embeded by a custom class which work perfectly fine. But the minute I give the child movieClip a instance name, the error starts up again.

[Code]...

View 1 Replies

Flash :: Accessing Movieclips Within Movieclip Using For Statement?

Nov 1, 2011

I am trying to access movieclips within my movieclip using a for statement. To try and make this clear, here is how it looks at the moment:

sections = Holder movieclip where dtf_sections is placed, as well as other clips that are needed.

dtf_sections = Where all the title movieclips are placed that are going to be used when called. Placed in here to make it easier to move, within sections

title = Movieclip that contains the text that needs to be changed, within dtf_sections

Here is my code that works:

sections.dtf_sections.title1.dtf_title.text = "Section 1"

There are upto 10 titles within dtf_sections. So, what I thought would work is this:

for(var i:uint=1; i<10; i++){
sections.dtf_sections.["title"+String(i)].dtf_title.text = "Section" +(i)
}

The reason why they are within the movieclips is masking, and appearing at different times.

View 1 Replies







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