Movieclip Depth bug
When placing a movieclip with a textfield behind (with lower
depth) another movieclip with a bitmap, the movieclip with the
bitmap should cover the textfiled completely right? Well, it only
covers the textfield 96%, the textfield kind of interferes with the
bitmap, its possible to kind of see the shape of the text through
the bitmap.
When using the "low" quality setting the problem dont happen.
I figure there is a bug in the smooth operation in the rendering
process.
Everything was created dynamicaly with actionscript 2 (flash
8). The textfield is with embedFonts=true and the bitmap was
created with BitmapData.
Anybody seem similar problem? Any comments apreciated...
Thanks
Mario
(i hope that isn't me being credited with an obviously false statement like, "..keep all my movieclips onto 1 layer/mother mc to speed up the flash display engine".)
anyway, if you want to add something to the top of the displaylist in a parent, use:
parent.addChild(something);
if you want to add something to the bottom of the display list in a parent, use:
parent.addChildAt(something,0);
if you want to add something betwen the top and bottom, you'll need to keep track of your depths or use some other artifice
Similar Messages
-
Hi
I have a movieclip on the stage called "scroller"
I also have some code which is sucking in external swfs from an array, and displaying and playing them consecutively.
Problem is, the external swfs are covering part of my "scroller" swf, which I don't want to happen.
How do I make the scroller swf stay on top all the time? I've tried playing with layer heights, and child index settings, but I haven't nailed it.
Here's my external swf code - thanks for taking a look - Shaun:
// Array of external clips to use. Variable index refers to next clip to be displayed.
var clips:Array = ["001/.swf", "002.swf"];
var index:int = 0;
// Stuff to load swf files
var thisLoader:Loader = new Loader();
thisLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, doneLoading);
//loader.contentLoaderInfo.addEventListener(Event.COMPLETE, dataOnLoad);
var thisMC:MovieClip = new MovieClip();
stage.addChild(thisMC); // Add empty MC initially so the nextClip function can be generic
// Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage
function nextClip():void {
thisLoader.load(new URLRequest(clips[index]));
// Tell AS that the loaded file is a movie clip and add it to the stage.
function doneLoading(e:Event):void {
stage.removeChild(thisMC);
thisMC = MovieClip(thisLoader.content);
thisLoader.unload();
thisMC.addEventListener(Event.ENTER_FRAME, runOnce);
stage.addChild(thisMC);
fscommand("fullscreen", "true");
thisMC.gotoAndPlay(1);
// When thisMC has finished, play the next clip.
function runOnce(e:Event):void {
if (thisMC.currentFrame == thisMC.totalFrames) {
thisMC.removeEventListener(Event.ENTER_FRAME, runOnce);
index = (index + 1)%(clips.length);
nextClip();
// Call the nextClip function initially to get the ball rolling
nextClip();Hey kglad
But scroller is a movielip I made in the IDE, so there is no loader - it just sits there permanently. The external swf loading code is on the same timeline as what the scroller MC is. Or am I misunderstanding your answer?
Thanks
Shaun -
Flash CS3 MovieClip artefact/bug?
Hi there,
I'm having a serious problem with line artefacts appearing in
a SWF movie.
They appear between exactly adjacent MovieClip symbols that
should have no intervening space (most obvious when the adjacent
shapes happen to be the same colour).
My workflow is:
1) Take a PNG image and Live Trace it in Illustrator CS3 to
fills, save as AI.
2) Import CS3 AI to Flash CS3 and convert each shape to
MovieClip and give it a name using funky new wizard.
3) Manually change the colour of one of these MovieClip
instances to be the same as an adjacent MovieClip instance using
the Flash IDE
4) Publish to SWF9
Problem is the published SWF9 has serious line artefacts
appearing between the two shapes that are exactly adjacent and have
the same colour. They should instead visually blend together with
no thin line between them.
I can overcome this problem by NOT converting the shapes to
MovieClips when I import to Flash CS3 in step 2) above, and then
instead changing the colour of the same shape which is now a
Drawing Object. When I publish this version to SWF9, there is no
line artefact, just perfectly blended adjacent shapes.
Problem now is that I don't have instance names to import my
SWF to Flex and programmatically manipulate the colours of my
lovely little vector picture.
Can it really be the case that I have to choose between
visual integrity and programmatic functionality after all of the
recent releases and improvements?
Many thanks for your thoughts,
RichI found a hack to fix the problem:
Give every MovieClip instance a 0.25 solid linestyle with the
same colour as its fill colour.
This causes all of the adjacent MovieClips to very slightly
bleed into each other, thereby masking the unsightly gaps that were
appearing before.
Since my original post I discovered that the gap problem was
actually present (although more subtle) in the AI file after using
Live Trace. It became more pronounced after import to Flash CS3,
but can be managed as per above hack. -
New Tween onMotionFinished not working
Hello everyone,
I have :
//-----Class File
import mx.transitions.*;
import mx.transitions.easing.*;
class cTransition {
public function cTransition(){
public function AnimateScreen() {
myINTween = new Tween(arguments[0], "_alpha", None.easeNone, 0, 100, .25, true);
myINTween.onMotionFinished = function() {
AnimateScreen()
//-----fla timeline
var myMov:Object
myMov = new cTransition ()
myMov.AnimateScreen(myMov._childMov)
This code is within a class and the problem is that the "myMovieToAnimate" movieClip animates the first time around but when the tween finishes, it does not call the AnimateScreen() function again, why is this.
Any help here would be very much appreciated.
ThanksI have a similar problem in that my function is not being called when onMotionFinished is called. Any ideas on what I am doing wrong??
****************************** MY CLASS ******************************
import fl.transitions.*;
import mx.transitions.Tween;
class skitter.view.MainMenuView extends UIObject {
private var sliderTween
public function MainMenuView(target:MovieClip, depth:Number){
...constructor code...
/** Animate Main Menu **/
private function slideMenuItems(dir:Number):Void{
var newLoc:Number;
//To Make Sure Direction Calls Don't Call This Again Until Animation is Complete
failSafe = true;
// Move the Indicated Direction
switch( dir ){
case 1:
// Set New Slide Amount
newLoc = sliderStage._x + (mItemsArray[mItemsArray.length-1].getWidth() + offset);
// Move the Stage
sliderTween = new Tween(sliderStage, "_x", mx.transitions.easing.None.easeInOut, sliderStage._x, newLoc, speed, true);
break;
case 2:
// Set New Slide Amount
newLoc = sliderStage._x - (mItemsArray[0].getWidth() + offset);
// Move the Stage
sliderTween = new Tween(sliderStage, "_x", mx.transitions.easing.None.easeInOut, sliderStage._x, newLoc, speed, true);
break;
default :
break;
failSafe = false;
sliderTween.onMotionFinished = function() {
trace("CALL REDRAW FUNCTION")
Delegate.create(this, redrawMenu( dir ));
//redrawMenu( dir );
} // END slideMenuItems()
/** Redraw Items on sliderStage**/
private function redrawMenu( dir:Number ):Void{
trace("\t** REDRAW CALLED");
...code to draw items...
} // END CLASS -
Fireflies using AS3, conversion from AS2
Hey guys. I'm new to AS3. I do know the bare basics. I figure someone on here will know more than my teacher. (I'm paying for a class to learn actionscript, and as it turns out, he does as little of it as possible.) I wanted to have fireflies floating on my project, like particle effects. I have everything working with a tweaked version of an AS2 file I came across. Everything works in AS2, but I have no idea how to convert the syntax to work in my AS3 file. I get that they're different from each other, but can someone help me acheive the same results in AS3?
http://www.mediafire.com/?o3qcc9bbt8b4p73
The original is the file I'm trying to modify, and fireflies.fla is my modifications, in case anyone wants to see how poorly coded my translation was. It keeps telling me that it can't set the value for a String, though I'm not sure why.
There are two basic components. "Pointer" is an invisible instance that the fireflies use as an anchor (so they can't go off the page), and mcObj is called from the library and is the firefly graphic with coding.
The actionscript for the the parent is:
Stage.align = "";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
Stage.onResize = false;
damp = 0.65;
Fat = 2;
limx = 1000;
limy = 100;
maxScale = 8;
bugNum = 15;
startX = pointer._x;
startY = pointer._y;
pointer._visible = 0;
for (i=1; i<=bugNum; i++) {
attachMovie("bug", "bug"+i, i);
dot = eval("bug"+i);
dot._xscale = dot._yscale=maxScale;
dot.color = new Color(dot);
dot.color.setRGB("0xFFFF66");
dot._x = startX+Math.random()*600;
dot._y = startY+Math.random()*200;
btn.onRollOver = function() {
_root.light.gotoAndPlay(2);
btn.onRollOut = function() {
_root.light.gotoAndStop(1);
And the coding for the firefly is:
this._x = this._x+this.vx;
this._y = this._y+this.vy;
this.vx = this.vx+(Math.random()*2-1);
this.vy = this.vy+(Math.random()*2-1);
this.vx = this.vx*_parent.damp;
this.vy = this.vy*_parent.damp;
this._xscale = this._xscale-_parent.fat;
this._yscale = this._yscale-_parent.fat;
if (_parent.startX+_parent.limx<this._x) {
this.vx = -this.vx;
this._x = _parent.startX+_parent.limx;
if (this._x<_parent.startX-_parent.limx) {
this.vx = -this.vx;
this._x = _parent.startX-_parent.limx;
if (_parent.startY+_parent.limy<this._y) {
this.vy = -this.vy;
this._y = _parent.startY+_parent.limy;
if (this._y<startY.startY-_parent.limy) {
this.vy = -this.vy;
this._y = _parent.startY-_parent.limy;
if (_parent.maxScale<this._yscale || this._yscale<_parent.maxScale/25) {
_parent.fat = -_parent.fat;
Anyone who can help, please do. I need to have this done by the end of the week :///stage.align = "";
stage.scaleMode = "noScale";
stage.showDefaultContextMenu = false;
var damp:Number = 0.65;
var Fat:Number = 2;
var limx:Number = 1000;
var limy:Number = 100;
var maxScale:Number = 8;
var bugNum:int = 15;
var startX:Number = pointer.x;
var startY:Number = pointer.y;
pointer.visible = false;
for (var i:int=1; i<=bugNum; i++) {
//attachMovie("bug", "bug"+i, i);
this["bug"+i]=new but(); // assign class
addChild(this["bug"+i]);
var dot:MovieClip = this["bug"+i];
dot.scaleX = dot.scaleY=maxScale;
var ct:ColorTransform=dot.colorTransform;
ct.color = 0xFFFF66;dot.colorTransform=ct; dot.x = startX+Math.random()*600;
dot.y = startY+Math.random()*200;
btn.addEventListener(MouseEvent.MOUSE_OVER,onRollOverF);
btn.addEventListener(MouseEvent.MOUSE_OUT,onRollOutF);
function onRollOverF(e:MouseEvent):void {
MovieClip(root).light.gotoAndPlay(2);
function onRollOutF(e:MouseEvent):void {
MovieClip(root).light.gotoAndStop(1);
And the coding for the firefly is:
var initialized:Boolean;
if(!initialized){
this.vx=0;
this.vy=0;
initialized=true;
this.x += this.vx;
this.y += this.vy;
this.vx = this.vx+(Math.random()*2-1);
this.vy = this.vy+(Math.random()*2-1);
this.vx = this.vx*MovieClip(parent).damp;
this.vy = this.vy*MovieClip(parent).damp;
this.scaleX -= MovieClip(parent).fat;
this.scaleY = this.scaleX;
if (MovieClip(parent).startX+MovieClip(parent).limx<this.x) {
this.vx = -this.vx;
this.x = MovieClip(parent).startX+MovieClip(parent).limx;
if (this.x!=MovieClip(parent).startX-MovieClip(parent).limx) {
this.vx = -this.vx;
this.x = MovieClip(parent).startX-MovieClip(parent).limx;
if (MovieClip(parent).startY+MovieClip(parent).limy<this.y) {
this.vy = -this.vy;
this.y = MovieClip(parent).startY+MovieClip(parent).limy;
if (this.y!=MovieClip(parent).startY-MovieClip(parent).limy) {
this.vy = -this.vy;
this.y = MovieClip(parent).startY-MovieClip(parent).limy;
if (MovieClip(parent).maxScale<this.scaleX || this.scaleY<MovieClip(parent).maxScale/25) {
MovieClip(parent).fat = -MovieClip(parent).fat; -
Putting A Layer Over Drawing Canvas - Tile Map
I want to make it so that a layer will be above the map when its drawn.
Like I want a layer over this, cause im making a menu for the game, but the game is above the layer.
var tiles:Object = new Object({width:52, height:26}); // The size of the 'flat' tile. Tiles are allowed to be different dimentions, to give the '3D' effect.
var offset:Object = new Object({x:130, y:100}); // This object helps center the 'hero' to the stage.
var hero:Object = new Object({x:1, y:5}); // The starting position of the 'hero'
var canvas:Object = new Object({mc:_root.createEmptyMovieClip("canvas", _root.getNextHighestDepth())}); // Contains the primary movie clip and map information.
canvas.map = new Array( // Dictates the topography of the environment
// The reason I decided to to use 200 for walls and 100 for ground is to leave
// the option open add more tiles, such as 86 for another type of tile that is
// walkable. Since the collision detection code checks to see if the tile is
// less then 200 (less is walkable, 200 or above is not), there is no need to change
// the code toenable new tiles, simply name them a number between 0 and 200.
new Array(200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,193,196,196,196,196,189,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,187,182,182,179,190,100,200),
new Array(200,100,100,199,199,199,199,199,199,199,199,199,199,186,183,183,180,190,100,200),
new Array(201,199,199,199,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,186,183,183,180,190,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,194,185,181,181,178,190,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,192,195,195,195,195,188,100,200),
new Array(200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,200),
new Array(200,100,100,100,100,100,200,200,200,200,200,200,200,200,200,200,200,200,200,200),
new Array(200,200,200,200,200,200,200)
_root.onLoad = function():Void
initmap(canvas.map); // Draw the map
initplayer(); // Draw the player
return;
_root.onEnterFrame = function():Void
input(); // Handle keyboard movement
return;
function input():Void // Modifies the 'hero' object, handles collision detection ('hero' and wall)
// Any tile less then 200 is walkable, anything above is not.
// No need to change this code handle more tiles, just name the tiles a number.
// (not the best way to do this but simple, quick, and easy to do)
if(Key.isDown(Key.LEFT) && canvas.map[hero.y - 1][hero.x] < 200) hero.y--;
else if(Key.isDown(Key.RIGHT) && canvas.map[hero.y + 1][hero.x] < 200) hero.y++;
else if(Key.isDown(Key.UP) && canvas.map[hero.y][hero.x - 1] < 200) hero.x--;
else if(Key.isDown(Key.DOWN) && canvas.map[hero.y][hero.x + 1] < 200) hero.x++;
move();
return;
function move():Void // Moves the background and the hero
// These three lines handle swapping the tile depths to give the '3D' effect
var d:Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;
hero.mc.swapDepths(d);
canvas.mc["tile_" + hero.y + "_" + hero.x].swapDepths(d - 1);
// Move the hero in the opposite direction the environment moves
hero.mc._x = (tiles.width / 2) * (hero.y - hero.x) + offset.x;
hero.mc._y = (tiles.height / 2) * (hero.y + hero.x) + offset.y;
// Move the environment
canvas.mc._x = (tiles.width / 2) * (-hero.y - -hero.x) + offset.x;
canvas.mc._y = (tiles.height / 2) * (-hero.y + -hero.x) + offset.y;
return;
function initplayer():Void // Self-expalanatory
var d:Number = (hero.y * tiles.height) + (hero.x * tiles.width) + hero.y;
hero.mc = canvas.mc.attachMovie("hero", "hero_mc", d + 1, {_x:hero.x * tiles.width, _y:hero.y * tiles.height});
move();
return;
function initmap(map:Array):Void // Render map
var map_height:Number = map.length; // Determine height of the map
var map_width:Number = map[0].length; // Determine width of the map
for(var y = 0; y < map_height; y++)
for(var x = 0; x < map_width; x++)
// Movieclip depth is everything when doing an isometric game
var depth:Number = (y * tiles.height) + (x * tiles.width) + y;
// Attach tile to 'canvas'
var tile:MovieClip = canvas.mc.attachMovie("tile" + map[y][x], "tile_" + y + "_" + x, depth);
tile._x = (tiles.width / 2) * (y - x) + offset.x;
tile._y = (tiles.height / 2) * (y + x) + offset.y;
return;there are no layers when your fla is published (or tested). all displayobjects are assigned depths based on code used to assign depths and compiler code that assigns depths to objects you place on-stage in the authoring environment.
all objects placed on-stage in the authoring environment are placed at negative depths starting with about -16,380. that's why your menu (which is probably added to some layer in the authoring environment is below the movieclip you placed at nextHighestDepth() (which adds to no depth less than zero)
to change a movieclip's depth use the swapDepths() method of movieclips. -
Is there a way to move "back" and "forward" through the Library?
Is there a way to move "back" and "forward" through the Library?
For example, I'm editing Symbol_1, then I move to Symbol_22. Now to get back to Symbol_1 I need to find it again in the Library and double-click on it. Is there a shortcut for that?No, but you can always use the library search option to widdle down the number of items displayed. It'd be a good feature request as I find myself hopping between specific movieclip depths on common clips often. Sort of like a clip/depth bookmark.
-
Is it a bug about element's depth?
I have two elements in one frame and if I use:
alert(fl.getDocumentDOM().getTimeline().layers[1].frames[2].elements[0].depth);
alert(fl.getDocumentDOM().getTimeline().layers[1].frames[2].elements[1].depth);
It shows me 0 and 1, It is all right!
But if I don't select two of them , the depth is 2 and 2!
How it possible!!!!!
Is it a bug?Hi,
It works correctly for me. Can you share your test file along with the steps so that we can have a look at what's going wrong for you?
Please note that simple shapes(unselected) at the same layer have the same depth. If you have a drawing object or a symbol instead, then their deapth would be different.
-Nipun -
AIR - Major Bug (?) with MovieClip class
Hello all,
We are a team of developers working on ActionScript 3.0 project using Adobe AIR SDK and Adobe Flex SDK. During the development we discovered what seems to be a major problem with getting MovieClip instances to play correctly. More specifically, the problem has to do with the gotoAndStop method. If, using the gotoAndStop method, you perform a for loop over all MovieClip frames (from the 1st frame to the last one) and go back to the 1st frame again, then, after adding MovieClip to the Stage, the 1st frame won't be set, contrary to what's expected. Instead, the MovieClip selects the last frame, which messes things up. Are there any solutions to the described problem, other than switching to the right frame after the object has been added to Stage?
This seems like a 'no way out' situation - any help would be much appreciated.
A note: MovieClip itself is being imported from the 'swc' file.Thanks for the heads up and I'm sorry you guys have run into this issue. Is this is new to AIR 3.x?
Could you please open a new bug report on this over at bugbase.adobe.com, including a brief description and sample code/app to help us easily reproduce the problem. Please post back with the URL so that others affected can add their comments and votes.
Thanks,
Chris -
[Flash CS5.5] bug movieclips dont show/Really Slow on High Quality Textures
I have been using flash cs5.5 for a while now , and I start this project 3-4 days ago. Ever since I started to add in high texture in it, The program Freezes alot.
I export my project as a swf and theres no lag at all in it.(thanks to Render:Cache as Bitmap)
A bug happen when ALL the MovieClips/images/bitmaps No longer can be seen but u can click on it.
As u can see.
The visible is check in too.
All I was doing is moving the movieclips/images/bitmaps(high detail 2000x1000 big) around and this happen.
Also the program gets crazy laggy when high details are added. Then again , I export my project as a swf and theres no lag on the swf, full fps.
if this helps
intel(R) Pentium(R) 4 CPU 3.20 GBHz
3.19 GHz , 2.00 GB of RAM
After Reloading the hole file, everything is back to normal , but it still does this bug and its really slow. I cant Continue my project because of this bug.
Flash barely use my ram or cpu.
Help?Not for nothing but P4 single core CPUs are outdated by about 6 years. From your graphic I can see you're not using a version of flash in your era.
That doesn't excuse freezing but your CPU in this day and age is basically a solar powered calculator. Most people have an ancient dual core 2+GHz system with 2-8GB ram. You're excessively behind the CPU curve. With that CPU you're running DDR400 on top of it.
We're at DDR3 now (PC12xxx depending on your wallet).
Please don't take this wrong but "high res" and "Pentium 4" should not be in the same sentence. I'm fairly sure you cannot even play 720p HD video let alone 1080p HD video on that processor with windows (maybe linux). How do you expect flash to react being much more complex?
Your best option is to lighten the load on that old rig. Disable any antivirus software or anything else running to give your updated flash the best possible chance to run well given your computers limitations. Efficiency being king, sometimes people thing 3ghz = 3ghz. It doesn't. A 3ghz modern CPU will blow away your old 3ghz computer. This is not apples to apples. -
Depth of movieclips gets screwed-up
Ok I tried to resolve this before without any luck.
Tim was a big help but I don't realy understand it yet.
I have a flash movie, in that movie there are 15 instances
("drop1_mc" - "drop15_mc") of a movieclip all on the same level in
the timeline.
In frame 1 I give them a depth with getNextHighestDepth. I
trace the depths and all works fine.
In frame 2 I swap the stacking order with:
drop15_mc.swapDepths(drop14_mc);
drop14_mc.swapDepths(drop13_mc);
drop13_mc.swapDepths(drop12_mc);
drop2_mc.swapDepths(drop1_mc);
Basicly putting the lowest movieclip on top.
I trace the depths again and all works fine.
At frame 30 I jump back to frame 2 (nothing happens
inbetween).
But now all depths have gone loco! What am I doing wrong??
here is the code:
FRAME 1:
var k = 1;
for (i=1; i<=15; i++) {
this["drop"+i+"_mc"].gotoAndStop(12);
drop1_mc.swapDepths(_root.getNextHighestDepth());
drop2_mc.swapDepths(_root.getNextHighestDepth());
drop3_mc.swapDepths(_root.getNextHighestDepth());
drop4_mc.swapDepths(_root.getNextHighestDepth());
drop5_mc.swapDepths(_root.getNextHighestDepth());
drop6_mc.swapDepths(_root.getNextHighestDepth());
drop7_mc.swapDepths(_root.getNextHighestDepth());
drop8_mc.swapDepths(_root.getNextHighestDepth());
drop9_mc.swapDepths(_root.getNextHighestDepth());
drop10_mc.swapDepths(_root.getNextHighestDepth());
drop11_mc.swapDepths(_root.getNextHighestDepth());
drop12_mc.swapDepths(_root.getNextHighestDepth());
drop13_mc.swapDepths(_root.getNextHighestDepth());
drop14_mc.swapDepths(_root.getNextHighestDepth());
drop15_mc.swapDepths(_root.getNextHighestDepth());
for (i=1; i<=15; i++) {
trace("New Depth: "+this["drop"+i+"_mc"].getDepth());
FRAME 2:
this["drop"+k+"_mc"]._visible = false;
drop15_mc.swapDepths(drop14_mc);
drop14_mc.swapDepths(drop13_mc);
drop13_mc.swapDepths(drop12_mc);
drop12_mc.swapDepths(drop11_mc);
drop11_mc.swapDepths(drop10_mc);
drop10_mc.swapDepths(drop9_mc);
drop9_mc.swapDepths(drop8_mc);
drop8_mc.swapDepths(drop7_mc);
drop7_mc.swapDepths(drop6_mc);
drop6_mc.swapDepths(drop5_mc);
drop5_mc.swapDepths(drop4_mc);
drop4_mc.swapDepths(drop3_mc);
drop3_mc.swapDepths(drop2_mc);
drop2_mc.swapDepths(drop1_mc);
for (i=1; i<=15; i++) {
trace("New Depth: "+this["drop"+i+"_mc"].getDepth());
this["drop"+k+"_mc"].gotoAndStop (1);
this["drop"+k+"_mc"]._visible = true;
this["drop"+k+"_mc"].gotoAndPlay (1);
FRAME 30:
var k=k+1;
if (k>15) {
var k= 1;
trace("Var K: "+k);
gotoAndPlay(2);Glad you could move forward. Ok, next step with some extra
info (please
read all, the solution is at the bottom
1) Flash uses depths -16383 to -1 for elements that you place
on stage
at author-time (in Flash).
2) Flash uses depths 0 and above for elements that are placed
dynamically (using attachMovie, duplicateMovieClip,
createEmptyMovieClip)
3) When the playhead plays, Flash uses the depths as
identifier to know
when to move, draw, and remove movieclips.
Implications of the above:
==========================
* in a standard situation, you have a movieclip at a
author-time depth,
you can move the movieclip's position around, and have your
playhead
move forward and backward. Flash will realize that the
movieclip still
occupies the original depth and will let it be.
* however _IF_ you swap a movieclip from the author-time
depths to the
dynamic depths _AND_ if you play your timeline forward _AND_
if you jump
back to where Flash is supposed to draw the author-time
movieclips, THEN
the following will happen:
- Flash will see that the depth at which the author-time
movieclip
must be is now empty and will assume it must place the
movieclip again.
- You will then have duplicate movieclips _with the same
name_ on
stage: one at a positive depth (the one you manipulated), and
one at
negative depth (the one Flash added again as per the
author-time
specification). Of course the result will be all screwed up.
OK, this may sound a bit weird, here is a simple test case to
illustrate
this issue:
1) create new flash movie
2) in the library create a new movieclip with a simple shape
maybe a
circle or a rectangle
3) place the movieclip on stage and name it "myMC";
4) add some code to the timeline as follow:
[frame 1]
// nothing here
[frame 2]
// move the movieclip to a positive depth
myMC.swapDepths(this.getNextHighestDepth());
// shift it
myMC._x += 10;
myMC._y += 10;
[frame3]
stop();
this.onMouseDown = function()
// when you will click the mouse,
// the duplicate will appear
this.gotoAndPlay(1);
Solutions to this problem:
==========================
- do NOT change the depth of author-time movieclips, and
especially, do
not move them to positive depths (if your aplpication must be
dynamic,
use attachMovie to load the movieclips from the library
directly to
positive depths)
- If you must move author-time movieclips to positive depths,
do NOT
jump backward in your timeline.
hth,
Tim.
PS1: there are further implications to the 3 rules aboves but
they are
not affecting you right now so I wont elaborate on them to
not confuse
you
PS2: when you face a problem, always try to build the
simplest test case
that shows the problem. That is the best way to find out
whether the
problem is due an error is in your code or to an unexpected
behavior of
the Flash player.
Sarford wrote:
> Ok I tried to resolve this before without any luck.
> Tim was a big help but I don't realy understand it yet.
>
> I have a flash movie, in that movie there are 15
instances ("drop1_mc" -
> "drop15_mc") of a movieclip all on the same level in the
timeline.
> In frame 1 I give them a depth with getNextHighestDepth.
I trace the depths
> and all works fine.
>
> In frame 2 I swap the stacking order with:
>
> drop15_mc.swapDepths(drop14_mc);
> drop14_mc.swapDepths(drop13_mc);
> drop13_mc.swapDepths(drop12_mc);
> .....
> drop2_mc.swapDepths(drop1_mc);
>
> Basicly putting the lowest movieclip on top.
> I trace the depths again and all works fine.
>
> At frame 30 I jump back to frame 2 (nothing happens
inbetween).
> But now all depths have gone loco! What am I doing
wrong??
>
> here is the code:
>
> FRAME 1:
> var k = 1;
>
> for (i=1; i<=15; i++) {
> this.gotoAndStop(12);
> }
>
> drop1_mc.swapDepths(_root.getNextHighestDepth());
> drop2_mc.swapDepths(_root.getNextHighestDepth());
> drop3_mc.swapDepths(_root.getNextHighestDepth());
> drop4_mc.swapDepths(_root.getNextHighestDepth());
> drop5_mc.swapDepths(_root.getNextHighestDepth());
> drop6_mc.swapDepths(_root.getNextHighestDepth());
> drop7_mc.swapDepths(_root.getNextHighestDepth());
> drop8_mc.swapDepths(_root.getNextHighestDepth());
> drop9_mc.swapDepths(_root.getNextHighestDepth());
> drop10_mc.swapDepths(_root.getNextHighestDepth());
> drop11_mc.swapDepths(_root.getNextHighestDepth());
> drop12_mc.swapDepths(_root.getNextHighestDepth());
> drop13_mc.swapDepths(_root.getNextHighestDepth());
> drop14_mc.swapDepths(_root.getNextHighestDepth());
> drop15_mc.swapDepths(_root.getNextHighestDepth());
>
> for (i=1; i<=15; i++) {
> trace("New Depth: "+this.getDepth());
> }
>
> FRAME 2:
> this._visible = false;
>
> drop15_mc.swapDepths(drop14_mc);
> drop14_mc.swapDepths(drop13_mc);
> drop13_mc.swapDepths(drop12_mc);
> drop12_mc.swapDepths(drop11_mc);
> drop11_mc.swapDepths(drop10_mc);
> drop10_mc.swapDepths(drop9_mc);
> drop9_mc.swapDepths(drop8_mc);
> drop8_mc.swapDepths(drop7_mc);
> drop7_mc.swapDepths(drop6_mc);
> drop6_mc.swapDepths(drop5_mc);
> drop5_mc.swapDepths(drop4_mc);
> drop4_mc.swapDepths(drop3_mc);
> drop3_mc.swapDepths(drop2_mc);
> drop2_mc.swapDepths(drop1_mc);
>
> for (i=1; i<=15; i++) {
> trace("New Depth: "+this.getDepth());
> }
>
> this.gotoAndStop (1);
> this._visible = true;
> this.gotoAndPlay (1);
>
> FRAME 30:
> var k=k+1;
> if (k>15) {
> var k= 1;
> }
> trace("Var K: "+k);
> gotoAndPlay(2);
> -
Change depth of movieClip plz help!
Hi hope someone can help me out with this.
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.
if you can help i'd really appriciate it.
thx pavelHey here is the part of the code that happens after the click:
public function stickerpik(e:MouseEvent):void
trace("getting here");
for (var w:int = 0; w<=lengthtouse; w++)
trace("removing listener for " + iconarray[w]);
iconarray[w].removeEventListener(MouseEvent.CLICK,stickerpik);
//getrdy();
flap_Control.flap.gotoAndStop("blank");
trace(pagename+"====================")
//setChildIndex(e.target, 1)
e.target.gotoAndStop(3);
//Im trying to get e.target to be on top of everything.
currenticon = e.target;
indextrack = iconarray.indexOf(e.target);
currentblack = blackarray[indextrack];
mysotracker = mysoarray[indextrack];
e.target.startDrag(true);
e.target.mouseEnabled = e.target.mouseChildren = false;
currentblack.addEventListener(MouseEvent.CLICK,stickerput); -
hi, i m new for as3
i m looking for method similat to MovieClip.swapDepths(depth)
what is the method in as3, i have movieclips i wanne update those deths
thanks for help
Amit ShakyaSend to back
setChildIndex(example,0);
Bring to front
setChildIndex(example,numChildren - 1);
Relative to something else (swapDepths)
var otherindex = getChildIndex(theotherthing);
setChildIndex(example, otherindex)
setChildIndex(example, otherindex + 1); -
Resize Panels bug? Dragging panel depth is not smooth and continues after mouse up
I've noticed in both CS6 and CC when I adjust the custom panel layout by changing the depth of a panel or docked panels, the panel movement lags and often continues after mouseup. It's annoying and I have never seen this in CS5 or before. Does anyone else notice this? Surely it is not a "feature".
Mac OSX 10.7.5
AI CC 17.1Hi rcraighead,
Can you please attach some snapshots depicting your problem.
Sanjay. -
Problem/bug with mouse over movieclips
Been facing an annoying problem at here: www.villielain.com
Different site sections are located in animated objects
(mostly glowing) and when you mouse-over them the bottom menubar
shows up. The problem is that, when you go fast over multiple
objects (for example tv - cross - wall), the menu bar won't go
away.
I've separate actionscript layer for the menu items and can
send the original open file if it helps.
any suggestions? thanks.Issue 1: If the user leaves the Flash area (and moves over to
the black html background in this case), Flash doesn't register a
RollOut event, because Flash isn't underneath your mouse to capture
it.
Issue 2: Another problem is that when you display a new menu,
your code should remove or override any menu that's currently
displayed, rather than just adding a new menu to the stage or
making a new item visible.
Issue 2 can be fixed with some improved code. Issue 1 is a
Flash (AS2) limitation, but there are some workarounds. You can
start a timer when a button is rolled over. If no rollout event is
triggered after the designated time has elapsed, you can check the
location of the mouse and perform a hit test with your button.
Solving issue 2 will also reduce the occurrences of issue 1.
Maybe you are looking for
-
What can I do if my CD or DVD drive doesn't work properly in Windows 8?
QuestionWhat can I do when if my laptop CD or DVD drive doesn't work properly in Windows 8? AnswerNote: For help with this issue in Windows 7, please see this article. To get your CD or DVD drive working correctly, try these suggestions in the order
-
Updated the macbook pro and lost all my documents!!
I can't find any of my files and documents!!! Are they still on here, how do I recover them??!! PLEASE HELP ASAP!!!! ALL MY ESSAYS ARE GONE
-
Sharing DV video on externl HD between Mac & XP
Hi, I tried finding a post regarding this already but I'm still unclear. I don't know alot about media formats and if different OSs store them differently. My situation is: 1. I have an external HD (320gb) and I created 2 partitions, one for mac and
-
Can i fix this adobe reader keeps crashing over and over
im on facebook and it frezzes up then says adobe has crashed
-
Can any1 provide me the script file which will genrate the X-axis label and Y-axis label ?
I have two channels and I want to create a report with 2D axis system. I do not want to drag and drop those two channels into 2D axis system. Can any1 provide me the script by which I can automate the script in such a manner that while running the sc