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

Properly remove items from stage?

Guest
Apr 08, 2009 Apr 08, 2009

In actionscript 2 if you wanted items on the stage to not appear to the user you would just use the onclipevent(load) and then move them, alpha them and so on. In as 3 I cannot figure out how to get the items off of the stage before the stage renders them. There's always a flash of the stage items and then they disappear. What should I use? I don't like the addChild method because it's impossible to design a site that way. I like all my items on the stage and then go from there...

Thanks!

TOPICS
ActionScript
842
Translate
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 ,
Apr 08, 2009 Apr 08, 2009

i'm not sure what the problem is with addChild() but you can use the render event to detect when a displayobject is about to be rendered.  (use stage.invalidate() to force flash to dispatch the render event.)

Translate
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
Guest
Apr 08, 2009 Apr 08, 2009

I can't use add child because I can never figure out to work to movieclips and from movieclips to the main timeline while using addchild. I'm a self taught as 2.0 guy and no one can ever explain to me how to get my movie clip at page_1/video_clip to interact with functions I have on the main timeline. I use the MovieClip(root) and everything in AS 3 is making sense.

I don't know what to do with stage.invalidate()? Where does it go? What event listeners do I use as a result? Then what do I do?

Translate
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 ,
Apr 08, 2009 Apr 08, 2009

do whatever you want before they're rendered.  from you original message it looks like you want to remove them.

so you would use something like:

stage.invalidate();

do1.addEventListner(Event.RENDER,removeF);

function removeF(e:Event){

DisplayObjectContainer(DisplayObject(e.currentTarget).parent).removeChild(DisplayObject(e.currentTarget));

}

though, with knowledge of your particular situation you probably don't need to do all that casting.

Translate
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
Guest
Apr 08, 2009 Apr 08, 2009

Do you see it flash on the stage if you use something like this:

myMC.visible = false;
var i =new Loader();
i.load(new URLRequest("http://news.google.com/images/news.gif"));
myMC.addChild(i)
Translate
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 ,
Apr 08, 2009 Apr 08, 2009

no.  (oops, sorry -  that question wasn't directed to me.)

Translate
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
Guest
Apr 08, 2009 Apr 08, 2009

of course not, but as I mentioned I haven't had much luck with addChild yet. I'm giving it another try with this document, I'll post an update later...

Translate
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
Guest
Apr 09, 2009 Apr 09, 2009
LATEST

C-Rock,

Never heard back.  Did you get this figured out?

Translate
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