Drawing Objects in Front with Action Script

  • salmanq
  • Born
  • Born
  • salmanq
  • Posts: 2

Post 3+ Months Ago

Hi,

I have an action script drawing simple rectangle when the movie is run, but the shapes are drawn behind another layer.

For example my script is in Layer 6 and the Layer 4 is being shown above it. I want it to be the other way around.

I have placed Layer 6 at the top of all layers. and also tried placing my script in one of the frames of Layer 4.

Nothing has worked so far. Please help.

Salman
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

It doesn't matter where the script is in this case, it's the MovieClip that the script is targeting.

For instance, if the drawing methods are targeting a MovieClip like this.
Code: [ Select ]
myMC.lineTo(100, 0);


Then you need to make sure that the MovieClip "myMC" is at a higher depth than the MovieClip that is covering it on Layer 6.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

If you don't create any other movieclip using attachMovie, duplicateMovieClip or createEmptyMovieClip, then the top layer is over the others. Instantiate the a movieclip from layer 6 with myMC, then just do what joebert said.
Code: [ Select ]
myMC.lineStyle(1, 0x000000, 100); // set a line style with width 1, black color, alpha 100

// start draw from here:
myMC.moveTo(0, 0);
myMC.lineTo(100, 100);
  1. myMC.lineStyle(1, 0x000000, 100); // set a line style with width 1, black color, alpha 100
  2. // start draw from here:
  3. myMC.moveTo(0, 0);
  4. myMC.lineTo(100, 100);
  • salmanq
  • Born
  • Born
  • salmanq
  • Posts: 2

Post 3+ Months Ago

Thanks for the help.

I created my Movie clip using the createEmpty.. with the highest depth. Drew all my objects and it worked.

Removed it later when I wanted it to disappear.

Thanks again.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.