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
Similar Posts:
Jun 3, 2009
I was trying to access some nested movieClips from the main time line but it was giving an error. What I have is a movieClip on the stage called "dog" and inside this movieClip I have two nested movieClips called "dogLH" and "dogRH". The movieClip "dog" was brought to the stage using actionscript 3.0 and when I tried to move the moveClips inside "dog" it gave me an error.
This is the code I have:
var dogog = new Dog();
dog.x =200;
dog.y =150;
[Code]....
What is strange is that if I add the movieClip "dog" to the stage manually and try the same thing it works. Any idea why it doesn't work when it is brought to stage with actionscript, but it works if I bring this manually?
View 2 Replies
Feb 1, 2010
I have a movie clip menu on a main timeline and inside that movie clip I have created four buttons dynamically. How to access those nested buttons/movieClips (add event listeners etc) from main timeline? Here I am adding menu to the display list on main timeline:
[Code]...
View 2 Replies
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
Jan 18, 2010
I am having a newbie problem here. I am loading an external SWF with embedded movieclips (all clips are set to export in the original file). However, I can't figure out how to access those embedded clips in my new, parent, flash file. Here is my code:
Code:
var container:MovieClip=new MovieClip()
var house_Loader:Loader = new Loader();
[code].....
View 4 Replies
Mar 11, 2012
I have 3 dynamic textfields that are added to the stage through an external class, (I only add the main container from the Main.as) the textfields are nested under 5 MCs (that's what i see when i list objects in the debugger) how can i access those textfield from the Main document class?I've tried by path, by getchildbyname, i've exported the font for AS (the textfields have instance names)... and nothing works, i either get an error or it tells me it has no properties, or null..
View 14 Replies
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
Feb 2, 2010
I made a movieclip (map) with nested instances (cities) in IDE and I want to access them from non-document class.
But the class can't access them until it's added at the stage too.
If I add the class at stage, class can see and access only map, but not cities inside of it.
Both class and map are children of document class...
View 0 Replies
Jun 23, 2010
import com.hydrotik.queueloader.*;
.................
public class Main extends MovieClip
{
[code].....
I need to get access to loaded STRATTransitions.swf from the main movie and remove some text from it. There is no source code available for the swf.
View 1 Replies
Jan 30, 2012
I have two movieclips on the same frame but on different layers located within the movieclip. The first movieclip plays just fine. However, the second one isn't going ahead even a single frame. The code that I have mentioned below is located withing the second movieclip containing background image. And I think this code is causing the issue because when I remove this it plays perfectly fine. The function of this code is to automatically re-size background image with the browser dimensions. The whole code just worked fine on the main timeline.However, when I shifted it inside a movieclip its causing an issue.
//set stage for FBF
stage.align = "TL";
stage.scaleMode = "noScale";
[code]....
View 1 Replies
Jul 29, 2009
(Actionscript 2 btw - and actually cs4, not that it really makes any difference?) I have a class that instantiates a movieclip from the library, e.g.:
Code:
debugbar:MovieClip = thing.AttachMovie("debugbar", "debugbar_mc", 999);
So attaching it to the where ever "thing" is - could be movie clip or level0 or whatever, doesn't matter as "debugbar" is a private variable of the class. Now the important part - debugbar in the library is a movieclip that contains some components - buttons and textInputs. The problem comes when trying to access these components.
I would have thought that this would work:
Code:
debugbar.input_txt.text = "hello";
In order to set the text of "input_txt", the instance name of a TextInput component on the timeline of the movie clip (put there in author time). However, this does not work. Infact, I cannot access any specific "component" properties - they come back undefined. I can however set and retrieve MovieClip properties for the "input_txt", such as _x. However there is one added strange thing with this too - setting _visible to false doesn't seem to work (however perhaps a component by default overrides this).
I also appear not to be able to add event handlers to the component - at least for the usual component events. I tried casting it to a component, such as:
Code:
var temp:TextInput = TextInput(debugbar.input_txt);
trace(temp);
which gave "temp" as null.
However if you trace the thing itself without casting to what it is, it gives the path to correctly. It almost seems like the components are somehow broken when trying to access them this way - or that they cannot be accessed this way?
The thing is, I was able to access all of this before, when the code to do it was placed on the timeline (frame 1, the only frame) of the debugbar itself, where the components were child instances. This meant I could just reference them directly too - so input_txt rather than debugbar.input_txt , although that is probably largely irrelevant. I need to have it in a class though, as I need to pass in certain objects that need to be accessed by the mc.
View 2 Replies
Sep 1, 2010
This is probably a very simple solution, but I can't seem to find it online. Basically, I have a button that need to change a movieclip's frame in it's parent.So I tried:
ActionScript Code:
_parent.slideshowImages.gotoAndStop(2);
But it's not working! I know I'm getting to the right locaiton because _parent holds a variable, and I can access that just fine. But I for some reason can't access the movieclip at all.
Note: I can't upgrade to AS3 (What I'm used to) as this isn't my file.
View 9 Replies
May 4, 2010
I can reference the main library Class, but the clips nested within are coming up undefined and the usual parent.child.child method of accessing clips using getDefinition isn't working.
Here's my coding:
Code: Select allpackage {
import flash.display.*;
public class Menu extends MovieClip{
[Code]....
I tried both instances naming and Class naming in the library. It loads the clips within the menuClip. I can see them, but I don't have access for some reason.
View 2 Replies
May 22, 2010
I have the following code nested in a movieclip, how can I reference the stage correctly from that movieclip?
stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToArrowKeys);
function reactToArrowKeys(keyEvent:KeyboardEvent):void
{
if (keyEvent.keyCode == 37)
[Code].....
View 8 Replies
Dec 2, 2010
How can I call a MC from a class other than my main. I am making a side scroller and I when the player hits certain parts of the level I want the floor to fall out from under him (think Mario). I created a new class to attach to the different MC of the floor but I cant figure out how to access the player MC from the class. The MC name is playerMC that was exported for actionscript, and the instance name is player_mc. This is the class.
[Code]....
View 1 Replies
Dec 3, 2008
1) I created a movieclip (book_mc) on the stage. Inside the book is another movieclip (bookPages_mc). Inside of bookPages_mc is a third movieclip (subNav_mc).
2) On the root layer I created another movieclip (button).
3) On "button" I went to Linkage and gave it a base class of my own creation, "MainNav".
Now in the MainNav class I want to tell the subnavigation movieclip to animate.
The problem is - I can't figure out how to reference nested movie clips from an external class.
(For the record - everything has an instance name and has been double checked. The code works from within the FLA but not from an external class.)
Here is my class code (everything works except for the reference to the nested movieclip):
Code:
package {
//imports
import flash.display.MovieClip;
import flash.display.DisplayObject;
[Code]....
View 3 Replies
Feb 6, 2009
I have a couple of nested movieclips inside an interface file. There are some external movies that are imported (and their scripts call functions within the main class), and when I publish any of these I get these errors[code]...
View 6 Replies
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
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
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
Oct 31, 2009
My problem is that I have a moveiclip (called "clip") and I have other movieclips on that stage that are "branches", and those branches are made up of branch parts. These branch parts are in a movieclip called (branchpart) and some of these have been placed on the branch stage. When I am on the clip stage and I try to get the location branch[i].branchpart[j].x and ranch[i].branchpart[j].y,this location is given in the coordinates of the branch stage, not the clip stage. These branch parts are being moved in complex ways with respect to one another, so I am hoping that I can simply access the location on the clip stage of a single part without having to deconstruct the whole branch.
View 3 Replies
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
Dec 20, 2010
I have a class, the relevant parts of which are defined as follows:
class myClass extends MovieClip {
public function myfunc() {
trace( "mainVar: " + _root.mainVar );
}
}
As you can see, I want to access the variable "mainVar", which exists in the main movie, from within the class. This works fine, if I have only one instance of the class. But, if I have more than one instance, within separate movie clips, the value of mainVar is always taken from the first instance. How do I refer to the actual instance from within the class?
View 0 Replies
Jun 2, 2011
Here's my main class:
Code:
package
{
import flash.external.ExternalInterface;
[Code]....
Basically the class waits for the callback variable (my_msg). The problem is: I need to set the dynamic textbox text to my_msg variable.
How can I access it? I know I can access a public var in the timeline with functioname.variable but I can't define a public var inside a function, right?
View 4 Replies
May 18, 2010
I'm was getting good with as2 but recently made the mind switch from, I'll learn as3 tomorrow to as3 is awesome. The problem for me is that I don't understand the scope for classes. I know I can trace a variable on the main time line when the var is declared in the class. But how do you access a main time line var from a class? Here's an example - main time line Monkey.fla
Code:
var cagedMonkies:int = 10;
var monkeyTransport:MovieClip = new CarTrunk();
[Code]....
View 13 Replies
Feb 5, 2010
I have a button inside a movieclip. When the button is clicked I want it to make a movieclip in the main timeline go to a specific frame. what's the code I need to use to define that movieclip located on the main timeline? Right now I have my code written inside the movieclip where the button is located because I have multiple buttons on multiple frames, and I don't know the syntax to define a button in a specific frame inside a movieclip.
Here's my current coding...
Code:
Select allfunction bwbtn2(btn:SimpleButton,frame:Number) {
btn.addEventListener(MouseEvent.CLICK,function() {photobw_img.gotoAndStop(frame);});
}
bwbtn2(bw19_btn,19);
View 2 Replies
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
Apr 13, 2010
I wanted to remove an event listener from main class stage, but i get the error 1120: Access of undefined property stage. How do I actually access the stage?
custom class:
import main;
main.disableVcam();
main class:
public static function disableVcam():void {
trace("disable");
stage.removeEventListener(MouseEvent.MOUSE_MOVE, movevC);
}
View 1 Replies
Oct 26, 2009
my movie is linked to an external class called game, and in the game cosntructor I am trying to access instances on my stage. I have tried MovieClip(root).instancename, root.instancename and even tried adding an event listener to listen when the movie is done loading because I thought maybe it was because the instances on the stage weren't created before the constructor is ran. This is the main class, shouldn't it be easy?
View 2 Replies
Jun 2, 2011
Here's my main class:
[code]...
in the timeline I have a dynamic text box named my_textbox: var my_test:main = new main(); my_test.check_DVBViewer(); my_textbox.text = ??Basically the class waits for the callback variable (my_msg). The problem is: I need to set the dynamic textbox text to my_msg variable. How can I access it? I know I can access a public var in the timeline with functioname.variable but I can't define a public var inside a function, right?
View 3 Replies