indexScene内に作成したSoundPage.as (CastSpriteを継承) package page{ import flash.display.BitmapData; import flash.display.MovieClip; import flash.media.Sound; import flash.media.SoundChannel; import flash.media.SoundTransform; import flash.net.URLRequest; import jp.progression.casts.*; import jp.progression.commands.display.*; import jp.progression.commands.lists.*; import jp.progression.commands.managers.*; import jp.progression.commands.media.*; import jp.progression.commands.net.*; import jp.progression.commands.tweens.*; import jp.progression.commands.*; import jp.progression.data.*; import jp.progression.events.*; import jp.progression.scenes.*; // /** * ... * @author ... */ public class SoundPage extends CastSprite { private var title:MovieClip; // private var channel:SoundChannel; private var mysound:Sound; private var tf:SoundTransform; /** * 新しい MyCastSprite インスタンスを作成します。 */ public function SoundPage( initObject:Object = null ) { // 親クラスを初期化します。 super( initObject ); // title = new soundtitle(); this.addChild(title); } /** * IExecutable オブジェクトが AddChild コマンド、または AddChildAt コマンド経由で表示リストに追加された場合に送出されます。 * このイベント処理の実行中には、ExecutorObject を使用した非同期処理が行えます。 */ override protected function atCastAdded():void { var url:URLRequest = new URLRequest("sound/nos80.mp3"); tf = new SoundTransform(0); // var bar:MovieClip = new barset(); bar["bar"].scaleX = 0; var bm:CastBitmap = new CastBitmap(); bm.alpha = 0; // addCommand( new LoadSound(url, { onComplete:function() { mysound = this.latestData; channel = mysound.play(0, int.MAX_VALUE); channel.soundTransform=tf; } }), //soundボリュームアップ new DoTweener(tf, { volume:1, time:3}, {onComplete:function() { trace("complete"); }, onUpdate:function():void { channel.soundTransform = tf; trace("update"); }}), [ new Prop(bar,{x:0,y:(stage.stageHeight-bar.height)/2}), new AddChild(this, bar) ], new LoadBitmapData(new URLRequest("img/isetan.jpg"), { onProgress:function() { trace(this.percent); bar["bar"].scaleX = this.percent/100; }, onComplete:function() { bm.bitmapData = this.latestData as BitmapData; bm.x = (stage.stageWidth - bm.width) / 2; bm.y = (stage.stageHeight - bm.height) / 2+60; } }), // new DoTweener(bar, { alpha:0, time:2 } ), new RemoveChild(this, bar), new AddChild(this, bm), new DoTweener(bm,{alpha:1,time:1}) ); } /** * IExecutable オブジェクトが RemoveChild コマンド、または RemoveAllChild コマンド経由で表示リストから削除された場合に送出されます。 * このイベント処理の実行中には、ExecutorObject を使用した非同期処理が行えます。 */ override protected function atCastRemoved():void { } } } } }