Actionscript :: Reference A Dynamic Movieclip From An Outside Movieclip
Feb 21, 2010
I have built a movieclip (parentMC) that houses two movieclips within it (mcA, mcB).
in mcA, i'm dynamically attaching movieclips from the library through a loop.
in mcB i'm trying to reference a particular movieclip from mcA via "_parent.mcA". Doesn't seem to be working. However, when i reference said movieclips from the loop within mcA - or even parentMC, it works fine.
View 2 Replies
Similar Posts:
Feb 21, 2010
i have created a movieclip (parentMC) that houses two movieclips within it (childA and childB)
in childA, i am dynamically creating movieclips via a loop:
Code:
var newX = 0;
var pagTotal = 8;
for(i=1; i<pagTotal+1; i++){
[Code].....
...and in childB i'm trying to reference one of these created movieclips via "_parent.childA.pagClip01" so on and so forth.
but they dont seem to be working. when i trace the dynamic clip from within childB i keep getting "undefined" in the output. however, I can reference the movieclip from within childA, and even from parentMC no problem.
i've used _root and _level0 absolute paths and still the same failed result.
View 1 Replies
May 9, 2009
how does one reference a MovieClip instance dynamically in AS 3.0? Example, I create a new instance of a "marker" MovieClip class that inherently has within it a series of embedded MovieClips labeled: "m1", "m2", "m3" etc ... and I want to be able to dynamically reference those embedded MCs.I used to do this all the time in AS 2.0, and can't recall how to do it in AS 3.0.I know it is something like this:
number = 1;
marker = new StaticMarker();
var thisMarker = this.marker.m[number];[code].........
View 3 Replies
Sep 3, 2009
I have a number of identical movie clips that are generated in responce to an XML file. I'm trying to reference a specific one of these movieclips after a sound file stops playing How do I call up that specific movieclip? How can dynamically created objects be referenced through the actionscript?
PHP Code:
for(var i = 0; i < 3; i++){varnew test() addChild(a); 150);
[code].....
View 5 Replies
Sep 30, 2010
I have 9 MovieClips on stage (p1, p2, p3...), different colors and sizes. I have one AS3 class "Snake" that as an instance is supposed to duplicate one of these MC's as a Shape. The reference to the specific MC is supposed to be on the constructor method. These instances are supposed to be triggered from one global Enter.FRAME event. How can I refer a distinct MC from within a class? I ask this because this MC will be dynamic and its properties ever-changing (position and color). I know this can be solved by adding distinct Enter.FRAME listeners per instance, but I'd rather avoid bad practices.
ActionScript Code:
public function Snake(id:MovieClip) {
body = new Array();
head=new Point(id.x, id.y);
size = id.width;
color = getColor(); // need to have a class variable that refers to the index
[Code] .....
View 1 Replies
Jul 17, 2011
I am trying to make a reference to a movieclip instance that is in another movieclip.
Here's the deal: I have a main timeline for different pages of a website...then within that I make all of the art on each page into a movieclip so I can do animations every time that main timeline frame is called to, yet still keep my main timeline clean.
Within one page's movieclip I have a few buttons that I want to use to go to other pages by referencing them on the main timeline.I have been using this: (home_about is the about us button on my home page, and frame 31 is on the main timeline).
home_about.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_6);
function fl_ClickToGoToAndPlayFromFrame_6(event:MouseEvent) :void
{[code].............
Since this home_about is within another movieclip,I get the access of undefined property error. Do I need to change the code I've pasted above or add in variable definitions to fix this?
View 1 Replies
May 20, 2009
I am trying to create an interactive graphic. Basically, it's three squares layered on top of each other, with a large square in back, a medium square centered in the middle of the large square, and a small square in front centered in the middle of the medium square.
When you roll over the medium square, say, it expands to almost the size of the large square and some text fades in, and the small square on top of it fades away. When you roll off of the medium square, it goes back to it's smaller size, and the small square fades back in.
Currently, I have the actionscript in the movieclip to make the medium square get larger and smaller (and the text fade in), but I need to somehow reference the instance of the small square movieclip to hide it when I roll over the medium movieclip.
My actionscript for the medium square activity, currently:
Code:
stop();
this.onEnterFrame = function(){
if(rewind == true){
[Code]....
how to have this rolling over action get rid of the small square and then bring it back on roll out.
View 2 Replies
Jan 14, 2012
For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:
[Code]...
View 2 Replies
Nov 14, 2011
I'm trying to do a cleaning of some classes that is added into a MovieClip, but I can't seems to set the MovieClip(Class) to null. What is the proper way to do it?
private var mcHolder:MovieClip = new MovieClip()[code].................
View 1 Replies
Oct 20, 2009
How do I reference the xth movieclip child object within the nth movieclip object? _root["Object_"+n]["Child_Object_"+x] doesn't seem to work.
View 1 Replies
Jul 26, 2004
If I have movieclip named box01_mc inside movieclip btn01_mc and I wanted to change box01_mc's alpha to 0 on the rollover of btn01_mc how would I write this? I tried writing the following code on btn01_mc but it didn't work[code]...
View 6 Replies
May 1, 2010
I have a movie clip I am adding to the stage via addChild() within this movieclips timeline I am trying to reference functions and variables on the main timeline.[code]...
View 4 Replies
Nov 12, 2011
The scene is a number of movie clips, all already added to the stage (i.e. not dynamically) and when one is clicked, I need to call a property of that clip. [code]...
View 3 Replies
Oct 14, 2008
How do you use a variable value as a reference to aMovieClip?I'd like to do this:
A2.visible = false;
myVar = A2;
myVar.visible = true;
[code]......
View 1 Replies
Oct 11, 2010
I have a movieclip (childMc) that is the child of another movieclip (parentMc) on the stage.My code creates a reference (refMc) to the child movieclip on the stage, and then deletes the previous parent movieclip (parentMc) through a call to function deleteChild. The problem is that the delete is deleting the reference also. How do I break the reference so that the reference (refMc) is kept on the stage? Here is my code:
Stage Code:
var refMc:MovieClip;
var parentMc:MovieClip=this.addChild(new parentSymbol()); // parentSymbol has childMc
[code].....
View 2 Replies
Mar 6, 2011
I realize this is very basic but i need a quick way of referencing all my objects in an array,I have a series of movieclips with instance names "block1" "block2"... etc.
I there a quick way to reference these in an array something like "block"+1 ?
View 1 Replies
Jul 3, 2011
In my main AS, I am using a MovieClip as a Container despite of the stage. In another AS file, I want to take the Container as a reference as well as addChild (such as bullets etc) to it, but I really don't know how to write the code.
If I only addChild in the current (sub)AS, it's working, but it's just a problem to removeChild.
View 2 Replies
Feb 24, 2009
I want to control the playback of the root from within a movie-clip.
neither this.gotoAndPlay(n), nor root.gotoAndPlay(n) work.
View 2 Replies
Jul 21, 2009
I've looked all over the web, including this forum and can't seem to find a solution to my problem. I have the following:A main movie (root) that loads external swf files as needed. These external swf files have movieclips within them I want to reference. So I have the following code in the main movie (root).[code]Everything up to the point of tracing through the loaded movieclip works fine. When the movie is tested, it does not seem to want to trace through all child information of the loaded movieclip.Essentially I'm doing this to see what is inside the loaded movieclips (though I know 'cause I can look at the fla file); however I need actionscript to be able to see into the loaded movieclips so that I can adjust another movieclip within the loaded movieclip as necessary.
View 2 Replies
Oct 2, 2009
I have a movieClip and would like to run a hitTestPoint() if statement on it, but only for a particular instance within the movieClip.
Would: 'movieClipName'.'InstanceName'.hitTestPoint () { work?
View 1 Replies
Jul 12, 2010
How can I reference a MovieClip within that same MovieClip's timeline. (I want to reference itself). Inside the MoviClip on the first frame I have this:
this.alpha = 0;
I want the MovieClip to have an alpha of 0 but it is still set at 1.
View 9 Replies
Jun 14, 2009
If n=1,b1.gotoAndStop(2); is to happen.n=2,b2.gotoAndStop(2); is to happen.But i don't want to put conditions like this.I want to putting something like this:b[n].gotoAndStop(2); or something.Is it possible.Is there any other alternate logic.
View 2 Replies
Nov 23, 2011
How would I remove this attachMovie? [code] I have tried these codes with no success [code]I am using flash 10.2, in flash professional 5.5.
View 1 Replies
Mar 27, 2010
My movieclips are being nulled when moving between scenes, they are created on the stage and accessed through as3. I have login screen with three button, one logout, one exits the system and the other takes them to the next scene. When going back to the login scene, and trying to access movieclips like add eventlisterners etc... it comes back with null object reference, claiming that my buttons which are on the stage are null and sure enough if I debug they are. Any reason why my movieclips are being made null when moving between scenes?
View 2 Replies
Jul 22, 2011
I've been trying to reference a Library symbol that is introduced in Frame 2 by using it's instance name, using timeline scripting only. I am trying to make a colour picker MC symbol for multiple re-use. Firstly I drew a small button on the stage and converted to MC, called textColourPicker of type CPicker (the class used to represent this MC in the Library). Inside this MC I have a button symbol called pickerButton
[Code]....
View 1 Replies
Feb 21, 2009
I want to send a string to a function and then, via the string reference a Sprite. Are theire any other ways to adress a sprite with a String value?I thought this[myString].alpha = 0.5; was gonna do the trick but i keep getting (1010: A term is undefined and has no properties.). I tried every possible solution it feels like. Delaring Strings locally and Global...but i can�t get it to work. And the String is well spelled btw![code]
View 3 Replies
Oct 6, 2009
I had a bunch of movieclips on the stage and each of them gets assigned a variable called "clientName" onLoad.
I want to later reference the movieClip whose clientName was "foo" and changes its color, move it, make it bounce, whatever. It seems like it should be possible, but I don't know the syntax.
View 0 Replies
Feb 2, 2010
I've had this problem with Flash for awhile now and I've always been able to find a way to work around it, but this time, I think I'm just going to have to figure out a way to do it. Say I have a bunch of movieClips on the stage that have text fields in them that have data dynamically assigned to them from an SQL database. Once I've assigned data to these fields, can I reference a certain movieClip that contains a predefined value within its text field?
So, if I had three movieClips on the stage, with textfields in them that have the values "500" "600" and "700" is it possible to just reference the movieClip whose textfield currently says "700"? It doesn't have to be a just a textfield, either. If I could reference them by variables assigned to them. Like, it I assigned them a variable called "id" and the values were "500" "600" and "700" would it be possible to just reference the movieClip whose "id" is "700"?
View 0 Replies
May 3, 2010
I loaded a SWF and passed the reference to a Class called Portfolio:
Portfolio.as:
ActionScript Code:
package
{
[code]....
Now I keep getting one error or another. Right now, it's telling me:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
I tried extending the thing but then I got a: "1203 No default constructor found in base class" error I just want to pass a simple MovieClip reference from one class to another.
View 1 Replies
Dec 13, 2010
I'm making a sidescroller for school and im trying to get my hit test working.
I'm having trouble because I'm not sure how to properly reference an movie clip that i added in my game engine (zombie_mc), to a seperate class for my bullets the code for adding my zombie to the stage
Quote:
if (zombieTime < zombieLimit)
{
//if time hasn't reached the limit, then just increment
zombieTime++;
[Code]....
View 4 Replies