PDA

View Full Version : Bring a Compont to front using action script


cyril85
11-02-2007, 07:44 AM
Bring a Compont to front using action script

I have made a video object in the fla file (First created a ne video in the library and dragged the video to stage and gave the instance name videoObject)and i have created a new class object.In the new object i have painted a portion of my stage using movieclip and after that i tried to play a video using my videoObject.but i cannot bring that video screen to the front because i have created two movieclip above the screen.Please help me to bring that video screen to the front stage without destroying the movieClips.
Please help me...

salim_designer
11-02-2007, 11:40 AM
Perhaps you will get some idea by the following code:

import flash.display.Sprite;
import flash.events.MouseEvent;

var container:Sprite = new Sprite();
addChild(container);

var circle1:Sprite = new Sprite();
circle1.graphics.beginFill(0xFF0000);
circle1.graphics.drawCircle(40, 40, 40);
circle1.addEventListener(MouseEvent.CLICK, clicked);

var circle2:Sprite = new Sprite();
circle2.graphics.beginFill(0x00FF00);
circle2.graphics.drawCircle(100, 40, 40);
circle2.addEventListener(MouseEvent.CLICK, clicked);

var circle3:Sprite = new Sprite();
circle3.graphics.beginFill(0x0000FF);
circle3.graphics.drawCircle(70, 80, 40);
circle3.addEventListener(MouseEvent.CLICK, clicked);

container.addChild(circle1);
container.addChild(circle2);
container.addChild(circle3);
addChild(container);

function clicked(event:MouseEvent):void {
var circle:Sprite = Sprite(event.target);
var topPosition:uint = container.numChildren - 1;
container.setChildIndex(circle, topPosition);
}

You may need to do some minor changes in the code

cyril85
11-05-2007, 07:04 AM
First of all sprite is not supported in flashlite...Here everything is managed by movieclip.Anyways thanks for your reply...
thanks a lot..

salim_designer
11-05-2007, 08:06 AM
Hi there,

Which version of Flashlite you are coding for. So far I know, Flashlite does not support AS 3. Please post your thread to : FlashLite / Portable Devices Development.

Link: http://www.actionscript.org/forums/forumdisplay.php3?f=90

Cheers
Salim

cyril85
11-05-2007, 12:32 PM
yeah...i am using flashlite 3.That doese'nt support action script 3.I am using action script 2.Thank you for checking my post..

thanx a lot..