3

How do I create the AS3 equivalent of a moviescript with multiple frames?

If I were using the Flash IDE, I would put whatever stuff I wanted on frame 1, other stuff on frame 2, etc. and step through the frames as the user clicks the "Next" button. Or perhaps put in keyframes and tweens and let the system play through the frames at a fixed rate.

I don't see a way to do this in AS3, even though all the descriptions I've seen say that Flash CS3 turns your timeline and frames into ActionScript, and I would like to know how to do the same without having the Flash IDE (e.g., working in Flex).

Let's take a simple example: I have 3 frames. Frame 1 contains the splash page (a lot of text and a button). Frame 2 contains one image, one label, and one button that says "Next". Frame 3 contains two images and one label.

How would you build that in AS3?

4

2 回答 2

0

闪光连击

你将把你的逻辑代码放在关键帧中,并对文本、按钮等做一些事情。多用途很难编辑和处理它。

AS3 使用类似 Flash Builder 的 IDE

Flash CS will 只是用来制作动画的swf

假设我们有一个名为 A.swf 的 swf

  • 瑞士法郎

    • mySymbol(有一个类似 com.mySymbol 的链接名称)

      • subSymbol1(命名为 subSymbol1)

        • nameLabel(命名标签1)
        • 地址标签(命名标签2)
      • subSymbol2(命名为 subSymbol2)

        • nameLabel(命名标签1)
        • 地址标签(命名标签2)

这是您在 Flash Builder 中使用 A.swf 的方法

Class MyView {

   public function MyView() {

      var loader:Loader = new Loader();
      var url:String = "A.swf";
      var urlReq:URLRequest = new URLRequest(url);
      var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
      loader.load(urlReq, loaderContext);
   }

   private function onLoadComplete(e:Event):void {

       //now you can get defined symbols in A.swf
       var c:Class = getDefinitionByName(" com.mySymbol");

       //get a mySymbol  instance
       var mc:MovieClip = new c();

       //add to parent
       some.addChild(mc);

       /*what you said you got three frames,
       Just like set like subSymbol1 and subSymbol2 in this A.swf
       add some text in subSymbol1  and other in subSymbol2 */

       mc.subSymbol1.visible = false;
       mc.subSymbol2.visible = true;
   }


}

它可以使程序和视图以某种方式独立。

于 2013-09-08T00:24:02.943 回答
0

您很可能只是将这些帧中的每一个创建为单独的Sprite

当你想在它们之间切换时,你会使用removeChild()隐藏旧的并addChild()显示新的。

如果您想变得花哨,可以添加 Tweens(内置或来自补间引擎)。这将允许您在帧之间淡入淡出,或将它们放大,或从左向右滑动,或其他任何方式。

如果您需要制作更复杂的序列动画,您可以使用TimelineLite之类的工具来帮助您。

于 2013-09-08T00:00:22.900 回答