View Full Version : Problem with displaying an object over code
Here2Learn
December 14th, 2009, 08:16 AM
Greetings everyone, I'm new to coding in AS3 and I hope to learn as much as I can.
Two days ago I managed to create XML based gallery the problem is I want to create a menu OVER the gallery the issue is when I create an object and place it over the gallery it actually displayes it underneath the gallery. I'm sure theres a simple function to make it work as it sounds very simple to me, please the request may sound basic and I already googled my problem I would really appreciate any kind of help as it also very important for me to solve it as quickly as possible because I need to host it as a portfolio very soon to show to my clients. Thank you very much.:thumb: ciao
lope
December 14th, 2009, 08:53 AM
setChildIndex
Here2Learn
December 14th, 2009, 07:00 PM
Hi I tried it,worked but now I can't see my gallery.
I'm very new to coding. would you be kind and please explain more, my object is a movie clip and I want it to display over the xml gallery. Thanks.
Shaedo
December 14th, 2009, 09:21 PM
Here is some code to demonstrate visual levels.
You can swap the movie clip or text with your gallery for your case.
Copy and paste the code into a new as3 .fla file and CTRL + ENT
//create a demonstration movie clip and colour is green
var myMovieClip:Sprite = new Sprite();
myMovieClip.graphics.beginFill(0x00FF00);
myMovieClip.graphics.drawRect(0,0,50,100);
//Create some text to illustrate point
var above:TextField=new TextField();
above.text = '-------I am text that is above the movie clip';
above.width=400;
var below:TextField=new TextField();
below.text = '-------I am text that is below the movie clip';
below.width=400;
below.y=25;
var movedAbove:TextField=new TextField();
movedAbove.text = '-------I am text that is moved above the movie clip';
movedAbove.width=400;
movedAbove.y=50;
var movedBelow:TextField=new TextField();
movedBelow.text = '-------I am text that is moved below the movie clip';
movedBelow.width=400;
movedBelow.y=75;
//Add text in order.
//Those added earlier will be below those added later
//Those added later will be above those added earlier
addChild(below);
addChild(movedAbove);
addChild(myMovieClip);
addChild(above);
addChild(movedBelow);
//Change the placement of two peices of text to demonstrate setChildIndex
setChildIndex(movedBelow,0);
setChildIndex(movedAbove,this.numChildren-1);
Here2Learn
December 15th, 2009, 06:51 AM
Shaedo (http://www.kirupa.com/forum/member.php?u=138077) Thank you very much you saved me! :?) I'm so happy right now thank you for your efforts! Much appreciated!:emb:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.