Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash


Actionscript 3.0 :: Adding A MovieClip To An Instance?

I'm trying to place a MovieClip instance inside another instance on the stage, but flash keep shouting a good old error message at me, that being...

Code: Select all1061: Call to a possibly undefined method addChild through a reference with static type

Were as if I add it to the stage by itself, and not within another instance it works just fine? Here is my code...

Code: Select allpackage com.essenweb.projects
import com.essenweb.display.*;[code]...........

View 2 Replies (Posted: Mon Nov 23, 2009 2:56 pm)

Sponsored Links:

Related Forum Messages For Flash category:
ActionScript 3.0 :: Adding A New Instance Of A Movieclip?
I want to add a new instance of a MovieClip named chair_mc in my .as file but am not sure where to place it. I also want to bring in two other MovieClip symbols but am not sure where to place this. This is the code:

import flash.display.MovieClip;


Posted: Feb 3, 2010 9:50 AM

View 18 Replies!   View Related
ActionScript 3.0 :: Adding Movieclip Into An Instance?
i have a preexisting instance known as gamelevel. When the screen scrolls, gamelevel.x is modified. When the player shoots a projectile, this projectile is not moved along with the screen, because it is simply added using the addChild. How can i add the movieclip, but have it contained within the gamelevel instance?

Posted: 09-10-2009, 07:51 PM

View 1 Replies!   View Related
ActionScript 3.0 :: MovieClip On Stage - Adding Instance From Library
I have created a movie clip on the stage and in symbol properties I have checked "Export for ActionScrip" the MC name is "slide" and the class is "slide" base class is flash.display.MovieClip.

When I test the movie I get this error.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at main_fla::MainTimeline/frame1()

Here is my code:
PHP Code:
var slide = getChildByName("slide");//add instance from library?
function slideRollOver(event:MouseEvent):void {
} slide.addEventListener(MouseEvent.ROLL_OVER, slideRollOver);

Posted: 09-08-2009, 02:01 PM

View 5 Replies!   View Related
Actionscript 3 :: Constructor To Assign Instance Name From Super Constant When Adding Instance In Flash IDE?
I have a library object (SomethingMC) which extends a custom class (Something). Something, in turn, extends MovieClip.If adding SomethingMC to the stage within Flash CS3 IDE, is it possible for it's super class (Something) to assign an instance name from a class constant (Something.THE_CONSTANT)?

import flash.display.MovieClip;[code].....

The above does not work. It throws Error #2078: The name property of a Timeline-placed object cannot be modified. if the instance is assigned a name in the IDE, and it just doesn't work if no name is assigned in the IDE.

Posted: Jun 17 10 at 13:46

View 1 Replies!   View Related
Professional :: Instance Name When Adding From Library?
When addressing nested movieclips like so: _root.movieclip.movieclip.variable they need to have an instance name set, otherwise they count as undefined. So I can set that in the properties no problem, but when deleting it from the stage and then readding (manually or by actionscript) the instance name is gone thus I can not address nested clips by action script.

I don't understand how this will work then, since every time I add a clip by code it will have no instance name. The only alternative for me so far was keeping the clip on the stage the whole time, just out of bounds or invisible so I can still do stuff like _root.movieclip.movieclip.variable or _root.movieclip.movieclip.gotoAndStop(2).

Posted: Nov 11, 2010 2:46 PM

View 8 Replies!   View Related
ActionScript 2.0 :: Adding Array Value To Instance Name
I want to loop through an array and call the same method for each button instance. So instead of hardcoding this:[code]

Posted: July 11th, 2007

View 5 Replies!   View Related
IDE :: Adding Same Instance Of The Object To Stage Twice?
I`m having a silly problem with adding instance of an object to the stage two or more times. For example, this don`t work:

var temp0:SomeClass = new SomeClass();

Well, I know that one instance is one instance and two objects of the same class on the stage would be two instances, but still, it is what I need.

Posted: November 30th, 2009

View 1 Replies!   View Related
ActionScript 3.0 :: Adding A Dynamic Number To A Instance Name?
My name is Bryan i am 17 years old and i'm from the Netherlands. As i am trying to become a web design and developer i decided flash was a MUST to know, so i started trying flash and messing about. Now i'm trying to get into Action script 3.0 deeper. Currently i am trying to fix an externaly (XML) loaded image gallery for my self, except i'm a little stuck right now.Up to now all my code has worked. I've got 3 UILoaders set up for 2 jobs: Loading thumbnails (2 of them) and the other is for loading a 'full' version. I got that working. Except if i get huge images like a wallpaper etc. it screws up the size, so i set scaleContent to true.

- Set all the images dynamicly, with that i mean it loops trough all the thumbnails and gets the first 2, it dumps them into the UILoader wich is already the part i am failing at XD

- Check for the width and the height of the image (wich i either will include in the XML document or can i use something like: XMLData.image[ *number here* ].img_thumb.width (as a example)?

- Check if these are less than the UILoader's size and if they are less dissable scale content, if they are more enable it

So as i said im already failing at trying to dump the images in the thumbnails.I've got the following setup:

Root document has a MC: mc_content.
Inside mc_content we have: loader_image (full size of the image loader)
loader_thumb1 and loader_thumb2.

So what i want:

- Load the XML (works)
- Set some limits using variables (works)
- Start a for loop (works)
- get the thumbnail for the current image number (wich is a variable set and maintained in the for loop) (works)
- load the image into the loader_thumb *insert current image number here* (fails)

here is my current XML function:

ActionScript Code:
// Function that is called upon loaded complete
function xmlLoaded(event:Event):void{
// get the XML Data from the file


Posted: 01-11-2010, 07:05 PM

View 2 Replies!   View Related
ActionScript 3.0 :: Adding Instance Of Symbol To Stage?
I know this is one of the most basic things, but I am having trouble adding an instance of a symbol to the stage with action script in Flash CS4. I have a "fireball" symbol and at the beginning of my code I say:
var myFireball:MovieClip = new fireball;
But it says : "1180: Call to a possibly undefined method fireball."

Posted: July 29th, 2009

View 1 Replies!   View Related
ActionScript 3.0 :: Dynamically Adding Instance Names?
Is it possible to add a textField dynamically but have different instance name each time this is created? In other words if I have a button that whenever its click it will add a textField to the stage and assigns a new instance each time this is added.

button.addEventListener(MouseEvent.CLICK, addField);
var inputWidth = 200;
var inputHeight = 20;


Posted: March 31st, 2011

View 10 Replies!   View Related
ActionScript 3.0 :: Adding Function OnRelease To Instance Of A Button?
I am trying to add a simple navigation to an instance of a button on my stage through AS3. my code is below... I have used the same code in AS2, but i must be leaving something out in AS3..

btn_arrow_TL.onRelease = function() { gotoAndPlay("flyout_default"); }

Compiler Errors: 1120: Access of undefined property click.

Posted: Mar 26, 2010 4:59 PM

View 6 Replies!   View Related
Professional :: Adding Text And A Slideshow Instance Skews SWF Off Screen
I have a third party slideshow instance (SlideShowPro (SSP)) and have used the following code to allow SSP to resize to screen:

import net.slideshowpro.slideshowpro.*;
import flashx.textLayout.formats.BlockProgression;
stage.align = StageAlign.TOP_LEFT;


It all works fine. However, I am trying to put in links on the stage outside of SSP (i.e., Home, Gallery, About, etc.) as shown in this example website [URL]. When I do, the stage is truncated and part of SSP is skewed off the page.

How do I make sure that my stage containing text and SSP is captured as the SWF?

Posted: Jul 15, 2010 10:15 AM

View 1 Replies!   View Related
ActionScript 2.0 :: Hide MovieClips At Once By Adding Instance Names To Array
Is it possible to hide several movie clips at once by adding their instance names to an array, and then creating some kind of function?

Posted: December 1st, 2004

View 1 Replies!   View Related
Flash :: Address A Named Instance Of A Movieclip From The Class File Of The Movieclip?
I have a movieclip instance named 'placeholder' on the canvas, and I want to change the alpha of the named movieclip from it's class without effecting the alpha of all the movieclips of the same type. How would I specifically target the named movieclip instance that is on the canvas?

Posted: Jun 1 11 at 6:01

View 3 Replies!   View Related
Actionscript 3 :: Calling MovieClip(root) From A Dynamic MovieClip Instance Produces Error 1034
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:


Posted: Jan 14 at 0:55

View 2 Replies!   View Related
ActionScript 3.0 :: Access A Movieclip Via Its Instance Name In Another Movieclip Class?
how can i access a movieclip via its instance name in another Movieclip class?

and a nother question how can i access a movieclip via its class name in another movieclip class?

BTW i want to access the movieclip child

Posted: May 28th, 2011

View 4 Replies!   View Related
ActionScript 3.0 :: Make A Reference To A Movieclip Instance That Is In Another Movieclip?
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

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?

Posted: July 17th, 2011

View 1 Replies!   View Related
ActionScript 3.0 :: Adding Event Listeners For Movieclip Inside Movieclip?
I have a movieClip button in my library that I dynamically add multiple instances of to the stage using code (so each instance has a unique name). The button has two frames, so it has a basic rollover effect (just changes color. To make the rollover work, I've had to dynamically add an event listener to each new instance of the movieclip, which triggers the rollover function.

I was wondering, instead of adding an event listener each time, can I somehow have an event listener within the movieclip to take care of the rollover? Or will it not make any difference to the number of event listeners, as it will still add a listener with each new instance of the clip?

Posted: Nov 5, 2010 9:45 PM

View 1 Replies!   View Related
CS3 Play (reference) MovieClip Instance From Within MovieClip
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:

this.onEnterFrame = function(){
if(rewind == true){


how to have this rolling over action get rid of the small square and then bring it back on roll out.

Posted: 05-20-2009, 05:41 PM

View 2 Replies!   View Related
ActionScript 2.0 :: Objects - XML - Creating A New Instance Of An Object That Uses An Identical Name To An Older Instance Delete The Previous Instance?
Does creating a new instance of an Object that uses an identical name to an older instance, delete the previous instance? Or should the original instance be deleted first? The code uses a ridiculous amount of XML vars. Isn't it less memory intensive to parse the XML and save the properties to an Object, and then delete the XML Object, rather than keep the XML Object around and reference it's child nodes directly? Is it better form to break up a huge XML file (>600lines/3200vars) into smaller chunks?

Posted: March 20th, 2009

View 1 Replies!   View Related
ActionScript 3.0 :: Adding Movieclip To Main Movieclip
I have a scrollpane in my library.Inside a movieclip, I create an image gallery and add it to the scrollpane.I do this in this function.[code]Now everything works fine, and no problems occur.I do however get the runtime error TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.containers::ScrollPane/endDrag()It doesnt seem to affect my file, but I am sure it would be better to try and get rid of it.I think it has something to do with adding my movieclip to the main movieclip, and maybe.I am not removing it when I add a different movieclip.Whenever I add a movieclip to the main one, I use container_mc.addChild(...);Does addChild check to see if a movieclip already exist, and remove it if it does? Or do I need to remove my clips beforehand?

Posted: Mar 25, 2012 12:54 PM

View 2 Replies!   View Related
Flash :: When Adding A MovieClip To Another MovieClip, It Does Not Display?
I have a MovieClip called chipmovie which I have exported to a class method called ChipMovie, when I try and add it to another movieclip, for some reason it doesn't display.
I have checked Export for ActionScript and Export in Frame 1.The code that adds it to the MovieClip is as follows:

public function addChip(chip:Number)
var newChip:ChipMovie = new ChipMovie();[code].....

In the output it says:

init y = -151 height is 0

for all the ChipMovie objects I try to add.

Posted: Feb 28 11 at 14:07

View 2 Replies!   View Related
ActionScript 3.0 :: Have More Than One Instance Name On A Movieclip?
Is it possible to have more than one instance name on a movieclip?

Posted: February 7th, 2011

View 6 Replies!   View Related
Can An .as File Call A Movieclip Instance
I have want to tell a movie instance to play from a class:

`package com
import flash.display.MovieClip;
public class Global extends MovieClip


pic1m is the class, but I get 1120 undefined property error.If I just put; in my main timeline action layer it works fine, but I need the function playMask to be global in AS3...

Posted: 08-14-2010, 10:24 PM

View 1 Replies!   View Related
Copyright 2005-08, All rights reserved