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


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);

View 5 Replies (Posted: 09-08-2009, 02:01 PM)

Sponsored Links:

Related Forum Messages For Flash category:
ActionScript 3.0 :: GotoAndplay From The Instance On Stage To MovieClip In Library?
I am trying to learn ActionScript 3. I have a MovieClip called Ship in the library and have made class of it called ship. The Ship movieClip glows from Frame 6 to indicate when it crashes into an asteroid.The myShipMovieClip child is controlled by arrow keys and asteroid approaches. The hitTest works but I cant get the ship to glow i.e. from the timeline go to the Ship MovieCli in the library and go to frame 6 to start it to glow. I have managed to do this in ActionScript 2 but have tried for the last few days to try and do it in AS3here is my code :

import flash.display.MovieClip;


Posted: Nov 2, 2010 2:33 PM

View 3 Replies!   View Related
ActionScript 3.0 :: Adding Random MovieClip From Library To Stage Dynamically?
How to add random movie clip to stage from many different movie clips in library? If I wanted to add one movie clip to stage I would do liko so:

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
function onMove(e:MouseEvent):void {
var mc:MovieClip = new Ball();
mc.x = mouseX;
mc.y = mouseY;

Code above works perfect but I tried following but with no success, no errors, but nothing happens - no mc's are added to stage. I have 6 movie clips in library and they all are linked, exported for actionscript. On MouseOver I want to add random movie clip from those six movie clips to the stage.

var myArray:Array = [mc1, mc2, mc3, mc4, mc5, mc6];
stage.addEventListener(MouseEvent.MOUSE_OVER, onLoop);
function onLoop(e:MouseEvent):void {
for (var i:int = 0; i< myArray.length; i++) {
var randomMc:Number = Math.floor(Math.random()*i);
var mc:MovieClip = new myArray[randomMc];
mc.x = mouseX;
mc.y = mouseY;

Posted: 08-04-2009, 05:23 AM

View 8 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 3.0 :: Adding To Stage From Library?
just wondering why this code returns: 1137: Incorrect number of arguments. Expected no more than 0.when relating to this:var cm:collectionsMenu = new collectionsMenu('cm');


Posted: 07-07-2009, 07:11 AM

View 1 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
Professional :: FLVPlayback Adding To Stage Or Library?
I am unable to add the Action Script 3 FLVPlayback component to my stage or library in Flash CS5.5 when working with an action script 3 document.

Under components in the video folder i click and drag anyone of the FLVPlayback components (FLVPlayback, FLVPlayback 2.5 or FLVPlaybackCaptioning) to the stage and nothing happens. I am unable to add it to my library as well. All the other actionscript 3 components under the Video folder work. (BackButton, BufferingBar, CaptionButton, If I create an actionscript 2 document the FLVPlayback component drags to the stage and adds to the library just fine. So this appears to be an actionscript 3 issue only.

I have 2 other employees in my office using the same product and none of them have this issue. Only me.

I have tried to uninstall the product and reinstall but nothing helps. I have Flash CS3 installed on my PC and the product has the same symptoms as the Flash CS5.5 trial version that I am running.

I did not try this with Flash CS3 before I installed the CS5 trial. So I do not know if it worked prior to my CS5 evaluation.

Posted: Jun 17, 2011 7:36 AM

View 4 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 :: Error Importing TextField Instance From Library To Stage?
I'm making a project that is based almost entirely on code and I'm using classes. And everything was working fine until I came to a situation where I needed to make text field inside flash and not with code. I made a text field put some text inside, converted to a MovieClip, set the "export for actionscript" linkage in the library and deleted the movieClip from the stage.

Then went to my document class and wrote this code:

ActionScript Code:
var txt:text1 = new text1();
txt.x = 20;
txt.y = 20;

And I get this error: Error #1009: Cannot access a property or method of a null object reference.

Weird. I don't understand this problem. I then put this as3 code into the first frame and disabled the document class. And the text appeared normally on the stage.

What is even more weird. I get the same error even if I delete this code. In other words, I get this error just by having this text object inside my library.

So what do I do wrong? Why can't I use this command in my class? And what is happening this just by having this object inside my library?

Posted: 12-01-2010, 09:15 PM

View 9 Replies!   View Related
ActionScript 3.0 :: Adding MC From Library To Stage From External Class
I'm trying to create an application with an extensive user interface. I've come pretty far and decided I wanted to really take advantage of the object oriented features that AS3 has to offer.

I've started off by created a few classes: User, Background and Main. Main is the document class of course. In the document class I have a function "resetStage" that clears the display list of all children. This is because I have many layers of images making up the UI and they all show up at startup unless I remove them. Besides I want to see where the stuff is positioned in the Authoring tool so I don't want to just create movieclips and then delete them.

My issue is with my Background class. Basically what I want to do is create a new DisplayObjectConatiner called bgContainer or something and then put all the background stuff in it. (The main background image and a status bar image). Then add the bgContainer and its children to the stage. This should all happen when the object is constructed.

Main .as
public class Main extends MovieClip


Posted: Oct 14, 2009 10:34 AM

View 4 Replies!   View Related
ActionScript 3.0 :: Adding Objects From Library Vs Directly On Stage?
I am a flash developer and I've got some experience in games and applications, but there is a problem that always comes back and that I solve in sometimes discussing manners, but I've decided to find the "good way" of doing it.Ok, here's my problem :I have a game where I set the publish setting to export in Frame 10. Most of the graphic content is already on the stage on the frame 10, but there are a few MovieClips that I add and remove using AS from the stage (a "How To Play" movieclip, for example).All the movieclips I want to use with AS are set to export in Frame 10 and are used in different custom classes.Everything works just fine if I set everything to export on Frame 1 and all my graphics are on frame 10, but not if I export in any other frame than 1.The workaround I've found is to create an instance of the objects I want to load outside of the stage, but I hate that way of doing things :I get no error if I create an instance of my movieclips through AS, but they won't show up when added to the display list (yes, I know how to use addChild )

Posted: December 7th, 2009

View 5 Replies!   View Related
ActionScript 3.0 :: Adding Random Movie Clips From Library To Stage?
How to add random movie clip onMouse Move to stage from many (lets say 50) different movie clips in library? If I wanted to add one movie clip to stage I would do liko so:

ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
function onMove(e:MouseEvent):void {
var mc:MovieClip = new Ball();

Posted: 08-04-2009, 12:06 AM

View 0 Replies!   View Related
ActionScript 3.0 :: Mask Multiple Images Adding To Stage From The Library
I have a series of images I'm adding to stage from the library. I need them in separate movie clips for tweening. If I create a new layer... add a shape to the layer... mask the layer... finally, add a layer below that layer (with nothing on it) then all of the images I've added from the library are masked. No matter what I try with code however, I can only get one image to be masked. must you create a new mask for each image you would like to mask? I thought maybe if I could do it all in one go on a layer, there must be some code that allows one shape/mc/object to mask several clips.

Posted: 11-23-2009, 06:17 PM

View 3 Replies!   View Related
ActionScript 3.0 :: Creates An Instance Of The Library MovieClip?
I am having an issue with some code I found for a custom cursor.

import flash.ui.Mouse;
function init()

Posted: 10-08-2009, 02:20 PM

View 8 Replies!   View Related
ActionScript 3.0 :: Create An Instance Of A Library MovieClip?
I'm trying to write code that will dynamically add a falling leaf to a tree sprite every so-odd frames. But try as I might, I can't get the little retard to appear.[code]...

Posted: 08-02-2010, 01:55 AM

View 8 Replies!   View Related
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 :: 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]...........

Posted: Mon Nov 23, 2009 2:56 pm

View 2 Replies!   View Related
ActionScript 3.0 :: Instance Of MovieClip Imported By Shared Library
I have a movie clip, imported by shared library, in my main stage. Everytime I try to put an instance in this movie clip I get this error ( the movie clip in the main file ):
"1046: Type was not found or was not a compile-time constant: MenuDG."

The main library have this: menuEsterno - name of the item imported by shared library.
In its properties: Class: MenuDG; url: library.swf Source:. Library.fla Symbol Name: MenuDG
In the library.fla the same item is configured as follows: instance: nivel1
The library: MenuDG - name of the item in the library
In its properties; Class: MenuDG Base class: flash.display.MovieClip Export for ActionScript Export for runtime sharing Export in first frame; Url: library.swf Source: Symbol:

I'm working with Flash CS3;
I am providing a link to see the files. [URL]
Attachments: (2.8 MB)

Posted: Sep 24, 2009 12:45 PM

View 1 Replies!   View Related
ActionScript 3.0 :: Adding Clickevent To MovieClip In Library?
In actionscript3.0 how to make an movieclip in library clickable?? i have intially a button on the stage when i click tis button, then the movieclip should appear and then when i click the movieclip a new bitmap should appear.. my problem is when i click the button, then the MovieClip from library gets loaded. But "WHEN I CLCIK THE MOVIECLIP ITS NOT LOADING THE BITMAP DATA FROM THE URL I HAVE GIVEN..."

my coding are lik tis
var s : s1 = new s1();// s is the instance name given to movieclip whose
class is s1
function dsip(event:MouseEvent):void{


Posted: 10-12-2011, 10:03 AM

View 9 Replies!   View Related
ActionScript 3.0 :: Taking Movieclip From Library And Giving It An Instance Name Through Code?
I am making a game where I reference "Player_mc" quite a lot. I have a bunch of full characters (movieclips) in the library that work as the player when put on the stage and referenced as "Player_mc". I need a code that can reference those characters (movieclips) in the library, and move them onto the stage and name them "Player_mc". Also I need a way of removing an existing "Player_mc" so that another character can be referenced and brought onto the stage as "Player_mc". Here is what I have: if (this.P1Character==(Whatever that character's number is)){

Posted: 10-04-2011, 10:45 PM

View 3 Replies!   View Related
ActionScript 3.0 :: Adding Movieclip In Library Through Class To Frame
Okay, so I decided to try putting some child movieclip switches into the .as instead of in the frames. After a lot of Googling and reading, I think I learned that each of those movieclips need to be in their own .as. Anyway, I tried to do it and the movieclip, which is located in the .fla library and does have export checked off, is not showing up when I play the file. The movieclip has this .as to itself:


Posted: January 18th, 2011

View 4 Replies!   View Related
ActionScript 2.0 :: Load Movieclip From Library Into Another Blank Movieclip On Stage?
how to load a movieclip into a blank movie clip all in the same movie?!

Posted: February 8th, 2006

View 4 Replies!   View Related
ActionScript 3.0 :: Getting Library MovieClip's Onto The Stage?
getting a MovieClip item onto the stage within say the Document Class.

The trick is though, I would like to do it when the MovieClip linkage refers to a Class name, but does not actually have a Class document created.

I know that you could give it a class complete with document and that would be easy. But if you have say 10 enemy objects that literally do the same thing but just look different, why should I create 10 separate classes!

or am I barking up the wrong tree and I should just set up 10 different enemy styles within the 1 MovieClip and just attach the 1 Class to it?

Though I would still like to know how to get a MovieClip onto the stage dynamically from the Library when it doesn't have a Class file associated with the Class name in it's linkage

Posted: Aug 5, 2010 4:17 PM

View 4 Replies!   View Related
ActionScript 3.0 :: Add A Movieclip From The Library To The Stage?
All I am trying to do is add a movieclip from the library to the stage from the class below. The trace works but the dang thing does not show up. I am trying to get into using classes finally.

package classes
import flash.display.MovieClip;


Posted: April 27th, 2011

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