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


Similar Posts:


Flash - Accessing Nested Movieclips From Main Movieclip Class?

Feb 16, 2011

I have a MovieClip, that I'm going to add to the display list with my document class at runtime beacuase there will be many instances of it. The MoviClip "box" has 3 more MovieClip instances inside it,and each of those three have two more.It looks like this:

box
circle 0
oval0
oval1

[code]....

View 2 Replies

ActionScript 3.0 :: Accessing MovieClip Objects On Parent MovieClips?

Sep 11, 2009

So for my main timeline:

var lightBox:mc_lightbox = new mc_lightbox();
lightBox.x = 300;
lightBox.y = 200;
addChild(lightBox);

I get a lightbox up on the screen, within the lightbox is some more script, there are three menu options for that new window. So far when you click on it the loading part comes up just fine but whenever I have it go to another scene it leaves behind the lightbox above. I'm able to removeChild(loading) because its right there just a function above but I'm unable to removeChild(lightBox) because it's one up. How can I access that child? I tried many variations of parent, MovieClip, and root relationships but still couldn't get flash to find it.

View 1 Replies

ActionScript 3.0 :: Accessing A Child Of A MovieClip Composed Of Other Movieclips

Aug 13, 2009

I made a ship in flash, composed of different movieclips exported for actionscipt, then I converted the whole ship in a movieclip. I wanna access a wing to make it rotate but I don't know how. I tried this:

Code:
package{
import flash.display.MovieClip;
public class Prueba extends MovieClip{

[Code].....

View 8 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

Flash :: "IF" Statement, Within A For Statement, To Control Movieclip Within Movieclip?

Dec 18, 2011

I have a movieclip on the screen called "mc_bg". Within this movieclip are 7 movieclips called "barrier1" through "barrier7".From main.as I want to be able to do this call:

for (var i: int = 1; i < 3; i++ ){
trace("got here")
trace(mc_bg["mc_barrier" + String(i)])

[code]....

View 1 Replies

ActionScript 3.0 :: Accessing A Static XML Variable From Within A Switch Statement

Jun 1, 2009

In the following class

Code:
package
{
public class Factory
{

[Code]]....

A break point on the "Okay" line shows that x1 is null but x2 is equal to "<entity id="DRONE" points="100"/>".

If I take the whole block out of the switch statement, both x1 and x2 are equal to the expected xml.

View 6 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

ActionScript 2.0 :: Accessing Variables - If-statement Has Been Activated, _global.var1 Is Still 0 When I Trace It In Frame2?

May 25, 2004

I am making a jigzaw and when all the pieces are put in the right place, another movie clip will be played.All pieces are buttons placed in different movieclips. The movieclips are then placed in scene 1.

In frame 1, I've written
_global.var1=0;

In frame 2, I've put movieclip1, and in movieclip1 I've placed button1, with the following actionscript:

on (press) {
startDrag ("_root.movieclip1");
}[code]..........

However, when the piece is in the right place, and the if-statement has been activated, _global.var1 is still 0 when I trace it in frame2.

View 3 Replies

ActionScript 2.0 :: For...in Statement To Remove Multiple MovieClips?

Sep 5, 2005

I want to make a function that will remove every single mc symbol I've previously attached to a "mask" movieclip. So i created this:

removeAll = function(){
for(a in _root.mask){
a.removeMovieClip();
}
}

I thought if i do that itll remove each "a" it encounters but I guess I'm missing some part of that "for..in" syntax. Not sure how that works.

View 1 Replies

Flash :: Accessing A MovieClip On Script?

Aug 20, 2011

I'm used to working with AS3, but due to recent events I need to work with AS2, and I'm having trouble with a simple task: How do I access a MovieClip in AS? I drew something, converted it to a symbol (of type MovieClip) and ticked "Export for ActionScript". I gave it the name "MyMC". now, when I'm in some other MovieClips action, how do I access the MovieClip I drew on stage before?

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

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 2.0 :: Flash 8 - Accessing MovieClip In Container SWF?

Oct 19, 2006

Using MovieClipLoader, is it possible for the loaded swfs to access movie clips in the container swf movie? In building a preloader for a previously produced flash app (originally made for CD), I was running across huge problems with some dynamically created masks (created using attachMovie and setMask). My solution (not ideal, I guess) was to move the masks and the masked objects into the preloader ("container") movie. But still need to move them around by code located inside the swf being loaded.

Relevant code from inside the preloader:
myMCL.onLoadInit = function() {
_root.attachMovie("screenText12", "screenText12", 15)
_root.attachMovie("internalMask", "internalMask12", 17)
_root.screenText12.setMask("internalMask12");
}

And from inside the swf being loaded:
_root.screen12.onMotionFinished = function() {
screenText12InY = new Tween(_root.screenText12, "_y",mx.transitions.easing.Regular.easeOut, 463, 403, .5, true);
The red is where I'm not sure of how to get in contact with the movie clip in the preloader.

View 1 Replies

ActionScript 3.0 :: Flash Accessing MovieClip In A Class?

May 21, 2010

Document Class 'whatwedo'

[code]....I'm trying to access the loadMC movieclip in the document class. It dosnt work,

View 6 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 3.0 :: Accessing MovieClip From Flash Stage In Class

Jan 10, 2011

What is the best way to accessing movieClip from a flash stage in AS3 Class? And what if the as3 class it's in a package, outside the Document Class?

View 4 Replies

Accessing MovieClip Inside Button Object In AS3 (Flash CS4)

Apr 7, 2011

I want to dynamically load the graphic of the button into an mc inside each frame of the button (up and over). Inside each frame I have a movie clip (canvas and canvas_over). The green box is the button object (header_btn):

This is my code:
var hLoader:Loader = new Loader();
hLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, hLoaded);
hLoader.load(new URLRequest("[URL]"));
function hLoaded(event:Event):void {
[Code] .....
It would be nice though if as3 allowed for buttons to contain objects.

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 :: 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

ActionScript 2.0 :: Accessing Movieclips In Externally Loaded .swf

Aug 10, 2009

I am a newbie to AS 2.0..I only have basic actionscript 2.0 knowledge."I have one main .swf file and several external .swfs which I am loading through this code.[code]Now my problem is that I would like to access one "close_mc movieclip" in ourGroup.swf ...so that clicking that clip, I can exit the externally loaded .swf from the main .swf file."

View 3 Replies

ActionScript 3.0 :: Accessing MovieClips That Have Been Created In A Different Class?

Dec 15, 2009

I am able to dynamically create an object on the stage with a function, but I am at a loss for how to access and manipulate the properties of that object from my Main Class.

in my Main Class I have:

ActionScript Code:
NLP_addChild.addObject(stage)
// NLP_addChild is the other class  addObject() is the function

in NLP_addChild Class appears the following:

ActionScript Code:
public static function addObject(stage:Stage)
{
var myCircle:MovieClip = new circle()

[code]....

myCircle displays correctly on the stage, myCircle is correctly assigned an x of 300. But myCircle x property cannot be assigned from my main class.

View 2 Replies

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







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