ActionScript 2.0 :: [mc] Replacing A Movieclip Without Changing It's Children / Depth / Tweens
Feb 4, 2010
I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)
Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime. Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?
View 1 Replies
Similar Posts:
Feb 5, 2010
I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with a new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime.
View 5 Replies
Feb 5, 2012
Im trying to keep all my movieclips onto 1 layer/mother mc to speed up the flash display engine
I have these takable items(movieclips) that respawn after a while.
Initially i build the level starting with all the takable items before adding all the players/npc's. This way the player and npc's walk over the objects if they are not taken.
After an items respawns though, i have to re add them to the main mc and then they appear to be over the npc's and they seem to be moving under a carpet of stuff.
Its a nice 3d effect but totally unwanted in this scenario.
Is there a way to make sure that items are added as child before a certain clip (like the player). I tried using addchildat but this gives me a index error now and then. I dont really understand how the depths are worked out by flash.
I was thinking of storing the original depth of an item movieclip and then on restore, addchild at at its old depth. Or is there a more sensible way?
Also: can two movieclips occupy the same index/depth level? or are the incemented or something?
View 1 Replies
Jun 27, 2010
I have Macromedia Flash 8 Pro with AS2 and I was wondering if there was a function that would change the depth of a movieclip on rollover of a button.
View 1 Replies
Nov 2, 2009
i am trying to figure out how to replace motion tweens with using tweens in actual script
i am trying to achieve this [URL]
but using actual script instead of this. is this even possible, or does it require completely rewritten script?
View 0 Replies
Mar 14, 2011
I have this code that takes the string values out of an XML file:
Code:
publicfunction loadXML(xml:Event):void
{
[code].....
View 1 Replies
Feb 27, 2012
I have a problem with the getChildIndex() method. I have an array that stores multiple children and I want to perform a hitTest that only works on children with a certain depth, with one that is lower than the other hitTest "partner". Therefore I want to check the depth of that certain child.I tried to trace the depth, but I get crazy errors doing that. No matter if I do it from the child itself, or from the Document Class.
trace(getChildIndex(foes[7][1][1]))
[7] is the current level, [1] is the type of child and the second [1] is the child itself called [Object EnGob]. I put it there by the push() command.
View 3 Replies
Nov 13, 2009
I have a movie clip that has about 20 layers that make up four different groups. (Five of the layers work together)Any one of the four groups has to come to the front of the others at any time.Is there an easiesh way to swap depths of these groups?EG. Can you swap a folders depth for example?
View 1 Replies
Jul 5, 2005
Here is my issue. I have 6 MCs that are the same size and are on the same position on the stage. I am using AC variables to activate each one of them, here is an example of my script for the button:
Code:
on (release) {
if (number(test) == 2) {
[code].....
View 3 Replies
May 11, 2004
putting a movieclip into highest depth without knowing which clip is in the highest depth
View 2 Replies
Feb 20, 2009
Is it possible to display a MC above another MC without changing the depth? How?
View 1 Replies
Dec 12, 2009
so i watched the tut on motion tweens on how to change the color of stuff, but i guess im doing something wrong because its not working.are there step by step directions i can follow? also how would one change the color of a gradiant over time?
View 2 Replies
Mar 22, 2010
my designer made a fla file where he has animated layers loads of them. All the images inside those animations are loaded from outside the swf.
Now, the issue is at one point in time I want some of the objects to go under another object ( current their on top) . If I do this visually the images inside the swf(loaded) are lost.
View 1 Replies
Feb 10, 2009
There's a long story behind How I made it here and why I am messing with AS3 in the first place but I'll try to explain it in a shorter version. My boss seems to think that I am the equivalent of Einstein with computers and will tell me what he wants and just expect me to be able to figure it out. So he told me he wanted a website that looked like the Mercedes Benz website and left it at that.I am working with Flash CS3 Professional Version 9.0, trying my best to figure out all the ins and outs of the program, since I am a first time user. I have finished almost everything with the site. I have it all animated and working pretty well, but there's one main problem. I have 25 buttons, sorted out by 5 rows and 5 columns. These button all have pictures of golf carts on them and when you click on the golf cart it opens to show all the products that we sell for that particular cart. The first button works just fine, but all the buttons after that will not stay on top when they are selected.
I can't seem to figure out exactly what I need to do. I hvae struggled with ideas that I may need to put them in a container and then adjust their depths, but I am not sure if this is right or if there is any easier fix. Here's the code that I have so far on that particular page,Quote:
//Product1 Button
Product1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverProd1);
Product1.addEventListener(MouseEvent.MOUSE_OUT, mouseOutProd1);
[code]......
View 2 Replies
Jan 11, 2010
I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?
Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);
[code]......
View 9 Replies
Jul 9, 2009
I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this?
Here's my code...
ActionScript Code:
playPause_btn.addEventListener(MouseEvent.CLICK, onPlayPause);
function onPlayPause(event:MouseEvent):void{
[Code].....
View 1 Replies
Jul 9, 2009
I've got music player and one of the controls is a movieclip which acts as a PLAY and PAUSE button. What I would like is to swap the image of this movieclip everytime it's clicked. How would I go about doing this? Here's my code...
[Code]...
View 1 Replies
Oct 27, 2010
I'm creating a platforming game, and I have a fun little water thing set up. My goal is to be able to drag a water object from the library to the scene, and have the water physics kick in when the game starts.
To do this, I made the water object a black line, because width is necessary to know how wide I'd like the pool to be. Within the class I have a heightmap, so then I can connect all the heights together with lines using the drawing API.
The problem is, I can't get the original black line to disappear while still displaying the new lines and points Setting the alpha to 0 will permanently make everything invisible. I'm kind of new to this so maybe it's a dumb question.
View 4 Replies
Jun 12, 2011
At the moment I am busy editing a little flash game, but i was wondering if i could replace the part below for a movieclip
ActionScript Code:
this.graphics.beginFill(0x333333);
this.graphics.drawRect(0,0,25,25);
this.graphics.endFill();
View 2 Replies
Nov 14, 2011
But now the tracks are objects in an array, that will grow larger and larger (and slow down the game over time). How can I paint them on the level bitmap? And how to reload the bitmap when you restart?Have searched for an answer for days but have not found one.I know how to combine a bitmap and add it to the stage, but not how to replace it in the movie clip object:
var newLevel:BitmapData = new BitmapData(grassLevel.width, grassLevel.height);
var newDebree:BitmapData = new BitmapData(debree.width, debree.height);
newLevel.draw(grassLevel);
[code]......
View 1 Replies
Apr 27, 2011
Hi there I am still a novice to Actionscript 3 and would like some help please. I am creating a grid style image gallery that is XML driven. What I need help with is getting my images to, at random times, swap out with another image. Each image is added inside a Movieclip and can be unloaded. What I need is to load another random image into the now empty MovieClip. Hope this is ok description.
[Code]...
View 1 Replies
Nov 18, 2009
I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)
Code:
<root>
<dir name="images">
[code]....
View 2 Replies
Aug 11, 2011
I m looking for method similat to MovieClip.swapDepths(depth).what is the method in as3, i have movieclips i wanne update those deths
View 4 Replies
Nov 13, 2005
How can I set the depth for a movieclip.Actually I want my popup to always come on the top and there is some problem using swapdepth.Would it help setting the depth of movieclip to be something like 10000??
View 1 Replies
Nov 23, 2010
I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -
mx:Canvas
view:MyImage
mx:Bitmap
[code].....
View 1 Replies
Feb 6, 2011
So I have a bunch of objects (thumbnails) and I want every photo to be displayed on top of other photos once it's clicked. So what should I put inside the click handler inside the photo object?
View 1 Replies
Feb 15, 2011
I want to give a movieclip a specific depth number, but i cant found a method for this.
View 2 Replies
Jul 13, 2011
Im trying to change the depth or index of a movieclip when its click. And bring it to the top of everything. The problem is that the movie clip is not added by addChild, but nested in a frame.
so if i try and use any of these:
anyMC.parent.setChildIndex(anyMC, anyMC.parent.numChildren-1);
or public function bringMCToFront($mc:MovieClip){ $mc.parent.setChildIndex($mc, $mc.parent.numChildren-1);}
by it gives me this error: Error #1065: Variable setChildIndex is not defined.
View 6 Replies
Sep 3, 2008
I have 4 movieclips on my "layer1". Everytime my mouse is onRollOver of a movieclip, I just want THIS movieclip coming to the FRONT, that's to say the Highest Depth.
(in Visual Basic, "ZOrder(0)" is simple.. but harder in ActionScript.. lol )
I've found some many examples "around" this, but did'nt success to adapt the code to my simple needs !
View 9 Replies
Oct 26, 2009
Is it possible to keep a movieClip at the lowest depth and stack other movieClips on top. I have a container movieClip that I add a movieClip called floorTile. I want floorTile to always be at level 0 no matter what. Then when I click on another movieClip, I want this to be added on top of the floorTile.
ActionScript Code:
//create a container to hold the floor tile and textures
var myContainer:MovieClip = new MovieClip()
myContainer.x=425;
[Code]....
View 9 Replies