Home > progression > SceneObjectから子swfでLinkageしてるクラスをnewする

SceneObjectから子swfでLinkageしてるクラスをnewする

  • Posted by: ぢゃぃ
  • 2009年3月 9日 12:18
  • progression

最近は、Progressionでお願いします。と、
はじめから言われる事もあるような今日この頃ですが、
あるシーンで、子swfを読み込んで、その子swfにリンケージしてあるクラスをnewしようとして、
少しはまったので、メモ。

はじめは、
何となく_onLoadの中でaddCommandでコマンド処理走らせればいけるだろーとやんわり思ってました。

こんな感じ。


protected override function _onLoad():void {
     _container = CastSprite(progression.container.getChildByName("contentsContainer"));    
     var page:ContentsPage=newContentsPage(_name);    
     addCommand(          
          new AddChild(_container,page),          
          new LoadChild(page, new URLRequest("child.swf")),          
          new AddChild(page, new ChildLinkagedClass())     
    )
}


するとハァ━(-д-;)━ァ...
何も表示されません、、、

よくよく考えると当然で、
new ChildLinkagedClass()のコンストラクタが実行されるときには、まだ、子swfは読み込まれておらず、
currentのApplicationDomainに子swfにリンケージされたクラスがない、ってことです、、、よね?

とういわけで、
この流れの中で処理するためには、
new AddChild(page,new ChildLinkagedClass())コマンドをswfが読み込まれた後に、実行、というか、
execute()するという意味ではなく、newする必要があります。

というわけで、
こんな感じにするとうまく行きました。

実際に、Commandが作られる時を意識しておかないと、実際execute()される時の事だけ考えると少し混乱しますね。




protected override function _onLoad():void {
     _container = CastSprite(progression.container.getChildByName("contentsContainer"));    
     var page:ContentsPage=newContentsPage(_name);    
     addCommand(          
          new AddChild(_container,page),         
          new LoadChild(page, new URLRequest("child.swf")),           
          new Func(function():void               
               insertCommand(
                    new AddChild(page, new ChildLinkagedClass())
               )
          )     
    )
}

Comments:3

Comment Form
Ryba 2009年8月17日 01:54

Could you help me. Lack of money is no obstacle. Lack of an idea is an obstacle. Help me! Can not find sites on the: How do betting odds work. I found only this - fixed odds betting in nz. Ufc will take place tomorrow, august at the wachovia center in philadelphia, pennsylvania and will air live on pay per view at pm et pm pt. So before u move to costa rica to work for a sportsbook, think carefully what was said here. Thanks for the help :-(, Ryba from Republic.

Olivialz29 2010年1月22日 09:54

It is very feasible to order thesis project just about this good post at the dissertation service especially if students do not have time.

Elle 2010年2月13日 05:05

Hi guys. I just wanted to say, well done guys.Lovely. Help me! I find sites on the topic: Debt consolidation defaulted student loan. I found only this - student loan consolidation comparison. Student loan, video description: the special effect loan is following the then full university of operating for money continue often more secured because purchases are n't federal to combine by. Student loan, the try got a such bill for 2008, from april 12 to june 14, with all six websites to protect in one placement during the new willpower. Thank :cool: Elle from Bahrain.

Trackbacks:0

TrackBack URL for this entry
http://www.mononoahare.com/cgi/mt4/mt-tb.cgi/45
Listed below are links to weblogs that reference
SceneObjectから子swfでLinkageしてるクラスをnewする from もののあはれ_すたいるず

Home > progression > SceneObjectから子swfでLinkageしてるクラスをnewする

Search
Feeds
         
Tag Cloud

Return to page top