ActionScript 3.0 :: Adding Movieclip To Main Movieclip
Mar 25, 2012
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?
View 2 Replies
Similar Posts:
May 26, 2010
Im making a movie with a menu that loads movie clips according to which menu is selected simple enough. However, the newly loaded movie clip also needs to allow the user to load another movie into the main movie effectively swapping the first movie clip with the second. This needs to be done without using the main menu.
View 6 Replies
Nov 5, 2010
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?
View 1 Replies
Nov 20, 2008
I have a main timeline with a button. I need the action for this button to gotoAndStop to a frame within a movieclip, within another movieclip. I have tried on the main timeline setting the actions of the button to:
on (release){
clip1.clip2.gotoAndStop("frame1");
}
and tried:
on (release){
_root.clip1.clip2.gotoAndStop("frame1");
}
lastly:
on (release){
_parent.clip1.clip2.gotoAndStop("frame1");
}
If I double-click on the movie clip (clip1) and then double-click on the movie clip (clip2), I have several frames labeled "frame1", "frame2", etc.The button doesn't work.
View 7 Replies
Mar 6, 2012
Working on an RPG type flash, and I have to be able to control a text-box from quite a few locations. The one that is causing me trouble is the inventory. I need to be able to access the textbox with an instance of "statusWindow" from within the inventory clip (instance name "inventory"), so when I mouse over an item within the movieclip it will change the status window on the stage.In this instance I want to mouse over inventory.invHealth from the main timeline to get the display.itemName and itemProps are strings containing information about the item.I tried the following but it gave me a "possibly undefined" error.
invHealth.addEventListener(MouseEvent.MOUSE_OVER, itemStats);
function itemStats(e:Event):void
{
root.statusWindow.text = itemName+"
"+itemProps;
}
View 1 Replies
Feb 28, 2011
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.
View 2 Replies
Jan 17, 2012
I Have a flashmovie thats almost done and will soon hit the internet, but I want to add some animations into the website it�s two gears that I�m about to put at the bottom of the page and when a button releases in the main flashmovie the two bottom gears will turn a few frames and just stand still.These three movies are all separate (main movie, first gear and second gear).
It's a homepage designed in HTML and flash that has this "main flashmovie" in the middle of the screen, the size is about 1500(width)X800(height). And the gears is about 800wX200h placed at the left and right side bottom of the page. Dont worry the site is easy to apply to any screen resolution.I have been looking everywhere for any soul out there who suffering from the same problem but no success. Is it possible to script a button in the main movie to launch two separate movies in their own contents?
View 2 Replies
Apr 24, 2010
I'm trying to split my stage into 2 sections
- bubbleZone
- menuZone
so I have created 2 sections and turned them into movieClips. On the first bubbleZone movieClip I want to add multiple "bubble" movieClips which will only appear in the bubbleZone movieClip. See code below. However, the bubbles seem to be appearing all over the stage and are hidden by the bubbleZone movieClip. Is there anyway to make the bubbleZone movieclip pretty much just a background for catching events and then tying the individual bubbles to just the bubbleZone so they don't appear anywhere else on the stage?
var bubbleZone:BubbleZone = new BubbleZone();
bubbleZone.vx = 1;
bubbleZone.height = 600;
bubbleZone.width = 820.8;
[code]...
View 2 Replies
Apr 1, 2009
I have 290 transparent .png image files that i would like to be quickly added to a movie-clip so that i can use it as an animation. (As2 or 3 either way).
The pictures are all the same height/width and format. Is there a quick way i could import them to a movieclip quickly, as manually drag and drop into the movieclip is tiring?
View 1 Replies
Jun 15, 2009
My code is this:
Code:
stage.addEventListener(MouseEvent.CLICK, addBullet);
function addBullet(event:MouseEvent):void {
var bullet:MovieClip = new bshot();[code]....
bshot is a movieclip in my library with the class name of bshot as well.i do not understand when i click i do not get a bullet being added to the stage?
View 3 Replies
Aug 27, 2009
normally when i want to add a movieclip to the stage I would do this:[code]but I have an array of linkage ID's that I select from randomly at runtime so how do I code it to place it on stage?[code]
View 5 Replies
Apr 27, 2009
I had a problem with ScrollPane. My application consists of two Buttons(with instances: myBtn1,myBtn2).I added textfields to a movieclip(myClip) and again added this movieclip to a scrollpane(sp) using the code as follows:
var sp:ScrollPane = new ScrollPane();
var myClip:MovieClip = new MovieClip();
myBtn1.addEventListener(MouseEvent.CLICK,onClick);function onClick(evnt:MouseEvent):void {
[code].....
View 2 Replies
Aug 28, 2009
If I have the following on the timeline in my FLV, it works and attaches my movie from the library to the stage. If I do the same from my class, it does not.
var myMC:ToolTipMc = new ToolTipMc();
addChild(myMC);
View 3 Replies
Sep 10, 2009
//This small class add the same movieclip to the stage with random scale and position
// Garden represents a movieClip in the library
//attached fla and document class
Why using the same name garden for all instances of Garden is not a problem? Can I track each individual instance of Garden on the screen or recall it for something else?
[Code]...
View 1 Replies
Feb 3, 2010
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:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
[code].....
View 18 Replies
Mar 31, 2010
I am wrapping my head around AlivePDF. I can't seem to find an aswer to this question. Can I add a movieclip as the data to include inside the page? I have it so that the PDF generates text from specific text fields, but I want it to show "mainContent_mc" to the page. I am building this as an AIR app (apperantly you can't do this from an EXE file published from Flash).
View 1 Replies
Feb 19, 2010
i have created a preloader for my swf file. I want to simply add an image onto the stage whilst another swf is loading. My image is saved in a movieclip called image in the library. How would i add it to the stage and make it stay there whilst it is being loaded. I have tried manually moving it onto the stage but it only stays for 1 frame.
import flash.display.*;
import flash.events.*;
import flash.text.*;
[code].....
View 3 Replies
Aug 17, 2011
i have created a preloader for my swf file. I want to simply add an image onto the stage whilst another swf is loading. My image is saved in a movieclip called image in the library. How would i add it to the stage and make it stay there whilst it is being loaded. I have tried manually moving it onto the stage but it only stays for 1 frame.
import flash.display.*;
import flash.events.*;
import flash.text.*;
[code]....
View 1 Replies
Sep 22, 2011
My code is simply looping through an xml file and creating 'pages' (which are later animated).
This has all worked fine but now I want to add a sprite over the entire contents of the page if the contents of the xml contain a URL.
At run-time I can see that the checks for the URL are being processed correctly and that the overlay is being generated, but I cannot "see" it on the page.
The following code is located in a for loop for every page in the xml file:
var page:Page = new Page(); //MovieClip in my library
// ... other stuff
var textMC:FadeText = new FadeText(xml); //load the text from the xml fragment for this page
[Code]....
I now believe it is something wrong with the XML. It is correctly parsed XML (otherwise FlashPlayer would throw exceptions in my face) and it appears that this code works on every page except the second. Further more, if the second page is set as visible (a flag in the XML determins if the page is created or not) then none of the other pages overlay works.
View 2 Replies
Sep 2, 2009
An empty movieClip container will dynamically update it's width and height depending on the sum of it's child objects dimensions. Is there a way to add padding to this value?For example, say you have 10 child displayObjects within a movieclip and all together their width adds up to 100px. Therefore the parent clip's width is 100. Is there anyway to add say 2px padding around these child clips to make the parent clip's width 104? The basic goal here would be to set the parent's width independently and unrelated to it's contents dimensions.
View 7 Replies
Sep 10, 2009
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?
View 1 Replies
Sep 21, 2009
Lets say i use the code below to add the player movieclip into the gamelevel instance.
gamelevel.addChild(player);
When the player movieclip is added it is 'on top' or infront of the gamelevel instance.
Now i know you can simply move a particular instance back to the front with the addChild() function. However since i am adding Player1 into the gamelevel instance, this does simply nothing.
How can i add the player into a particular layer in the gamelelve instance?
View 2 Replies
Jun 12, 2010
My problem is as follows, I can create as many movie clips from on function as I wish, but as soon as I try and do two different functions - it messes up for some reason :S
Basically with my game, it is required for me to create these movieclips every so often. Because of this I created a re-usable function to do the creating:
ActionScript Code:
function create_note1() {
note1num++;
[Code].....
As you can see there are four different functions, and there are only 4 different movieclips that are added to the stage.
My problem is like this: I can call a single note (like create_note1();) as many times as I want without any problems, but If I try create_note1(); and create_note2(); It will remove note 1 and keep only note 2 on the screen. The problem really stumps me though, because if I called something like this: create_note1();, create_note2();, create_note4(); I may have notes 1 & 4 going down the screen and note 2 will have disappeared.
View 6 Replies
Mar 3, 2011
i wan't to make a game where the character jumps when i press a key, but i also wan't to play a "jump" sound when the player press the "jump" key. I tried to use this:
ActionScript Code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.SPACE)) {
kirupaSound = new Sound(this);
[Code].....
But it didn't work very well. When i pressed the "space" key it played the sound like 20 times untill it stopped.. It just continued to play the sound. Preview:megaswf(.)com/serve/1031811
View 8 Replies
Jun 15, 2009
I'm having some issues trying to add a movieclip to the stage through actionscript. Moving from AS2 to AS3 and it's a little daunting to get this concept.
Here's the code i'm using to add the movieclip:
Code: Select allvar flowerfader_mc:Flower = flowerfader_mc();
addChild(flowerfader_mc);
Here's a grab of my movieclip properties:
I keep getting this error: 1180: Call to a possibly undefined method flowerfader_mc.
View 4 Replies
Nov 23, 2009
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
Jan 30, 2010
Here's what I want to accomplish, I'm doing a listing of all the shows done by my band, I've written all the info into a XML file ( date, location, venue, info and a URL to get to the gig ) and I made a MovieClip with 4 field text to display the information.
So far I can read the XML file, I can addChild my MovieClip they stack neatly in a column to the stage...my problem is, after that, I don't know how to refer to them on the stage to get the url link that I've written in my XML file....here is my AS.
Pascal
//--- load the gig info ---
var xmlgig:XML;
var showlist:XMLList;
[Code].....
View 5 Replies
Jun 10, 2010
if my code is
Code: Select allvar mcFilters:Array = new Array();
mcFilters = mc.filters;
mcFilters.push(new GlowFilter());
[code]....
View 4 Replies
Mar 31, 2009
I'm still developing a game and I have some issues. Either I add a movieclip-child making it look like i am mowing the lawn or i draw graphics with blendmode.Erase erasing the top-layer.
Now i would like the addChild-solution because i can rotate, adjust size etc. very easy but ofcourse it laggs after a while. How can i make the added children into bitmaps or something? So there isnt 10000 movieclips on the stage..
[URL]
View 3 Replies
Aug 4, 2009
I have the 4 countries of the UK that get scaled up on click. I because each country is a different sizes geographically they do not scale up by the same amount. I would like to set a pixel scale size like this (scotland is the name of the movieclip)
scotland.expandWidth = 246;
scotland.expandHeight = 406;
The problem I am having is getting this value when the country is clicked, tried few things but nothing works.
trace(MovieClip(evt.target).expandWidth)
trace(evt.target.name.expandWidth);
View 1 Replies