• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to bring the external .SWF to a desired level, which is always on top?

New Here ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

Hi,

The following code works fine but always this external .SWF file stays on Top ot other Layers. How can I bring it down to the desired level (Say, if I have 10 layers and I would like this external .SWF on 5th layer).

var mySwf1:SWFLoader = new SWFLoader("AnalogClock.swf", {width:225, height:225, container:this, onComplete:completeHandler1});

mySwf1.load();

function completeHandler1(event:LoaderEvent):void {

    TweenLite.to(event.target.content, 0,{alpha:0});

    TweenMax.fromTo(event.target.content, 2, {x:225, y:-500, width:225, height:225, alpha:.5}, {x:225, y:300, width:225, height:225, alpha:1, delay:1, ease:Strong.easeOut});

}

TweenLite.delayedCall(20, mySwf1.unload)

Thanks.

TOPICS
ActionScript

Views

864

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

your SWFLoader class probably has an addChild method (eg, someObj.container.addChild(whatever) ) that you can exchange for addChildAt() in the class or you can use:

this.addChildAt()

elsewhere in your code after finding what's returned in SWFLoader.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

Hi,

Please help me in the following code:

Code.JPG

How to modify the above code to suit my requirement? My external .SWF File name is "AnalogClock.swf".

Regards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

it's your loader's name that matters, not the swf name.  unless the code in SWFLoader does something stupid like add the loader's content to the display list instead of adding the loader.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

Hi,

I am using the greensock loader to load my AnalogClock.swf.

import com.greensock.loading.LoaderMax;

import com.greensock.loading.SWFLoader;

Please advise.

Regards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2011 Oct 29, 2011

Copy link to clipboard

Copied

i don't know anything about the gs loader.  but he's a pretty good coder so you can probably see the loader's name in SWFloader's constructor.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 30, 2011 Oct 30, 2011

Copy link to clipboard

Copied

Thanks for the reply. Is there any sample code (other than greensock "gs" for achieving the same using the Flash CS4 pro

Regards.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2011 Oct 30, 2011

Copy link to clipboard

Copied

LATEST

i don't see any point ot using SWFLoader.  even though i don't know what it does, from the data your passing to the constructor, it can't do much.  use:

var mySwf1:Loader = new Loader(new URLRequest("AnalogClock.swf"));

mySwf1.contentLoaderInfo(addEventListener.COMPLETE,completeHandler1);

mySwf1.load();

function completeHandler1(event:LoaderEvent):void {

this.addChildAt(event.target,0);  // even if you continue to use SWFLoader, you can use this line to add your loader to the lowest depth

    TweenLite.to(event.target, 0,{alpha:0});

    TweenMax.fromTo(event.target, 2, {x:225, y:-500, width:225, height:225, alpha:.5}, {x:225, y:300, width:225, height:225, alpha:1, delay:1, ease:Strong.easeOut});

}

TweenLite.delayedCall(20, mySwf1.unload)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines