Professional Web Applications Themes

Translating from Flex to AS3 - Macromedia Flex General Discussion

As a Flash developer, one of the hardest tasks for me to understand in Flex is how to automate and control the creation of what used to be movie clips. For example, suppose I have a simple movie-clip-like structure that I want to te (see below). How could I do this (not as a new class, I'm still having trouble with those) within a <mx:Script> so that I can reproduce lots of new buttons (i.e. Video 1... Video n) using a for-next loop and then how can I control their visibility on stage. The only way I know how to ...

Sponsored Links
  1. #1

    Default Translating from Flex to AS3

    As a Flash developer, one of the hardest tasks for me to understand in Flex is
    how to automate and control the creation of what used to be movie clips. For
    example, suppose I have a simple movie-clip-like structure that I want to
    te (see below). How could I do this (not as a new class, I'm still
    having trouble with those) within a <mx:Script> so that I can reproduce lots of
    new buttons (i.e. Video 1... Video n) using a for-next loop and then how can I
    control their visibility on stage.

    The only way I know how to do this in Flex is to copy-paste lots of times and
    that seems to be an incredibly stupid thing to do!

    Thanks for you interest.

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:HBox width="100%">
    <mx:VBox height="100%">
    <mx:CheckBox id="videoCheckbox1"/>
    </mx:VBox>
    <mx:VBox height="100%" width="168">
    <mx:TextArea text="Video 1" editable="false" styleName="panelCell"
    width="125" height="30"/>
    </mx:VBox>
    </mx:HBox>
    </mx:Application>


    Sponsored Links
    SiHoop Guest

  2. #2

    Default Re: Translating from Flex to AS3

    Try using the repeater component:

    http://livedocs.adobe.com/flex/201/langref/mx/core/Repeater.html
    dimival Guest

  3. #3

    Default Re: Translating from Flex to AS3

    A Repeater can make it easier to code something in MXML, that's for sure. If
    you want to do it in ActionScript, then override the createChildren() method of
    the component file and use a for-loop:

    for(var i:int=0; i < someNumber; i++) {
    var videButton:Button = new Button();
    videButton.label = "Video "+String(i+1)";
    videButton.width = 50;
    videButton.height = 22;
    addChild(videButton);
    }

    How they lay out depends on the Container they are in. If you are using a
    Canvas (or Application/Panel with layout="absolute") then you have to set the
    x,y properties. If you are using Tile, HBox, or VBox you can leave it up to the
    Container to position them.

    Control their visibility by setting the visible property on the buttons to
    true or false, depending on your criteria.


    peterent2 Guest

  4. #4

    Default Re: Translating from Flex to AS3

    Fantastic. You have just opened a new world to me-- thank you so much!
    SiHoop Guest

Similar Threads

  1. English to Spanish Translating
    By prepressguy in forum Adobe Indesign Macintosh
    Replies: 0
    Last Post: September 17th, 02:22 PM
  2. Help translating fread to substr
    By RootShell in forum PHP Development
    Replies: 1
    Last Post: May 4th, 10:02 PM
  3. Translating individual vertices
    By findoutstuff webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 0
    Last Post: February 5th, 11:42 AM
  4. Translating Freehand 9 files into a *.dxf or a *.dwg
    By Steve Yahn in forum Macromedia Freehand
    Replies: 2
    Last Post: December 16th, 11:11 PM
  5. Help translating PHP to ASP
    By Jules in forum ASP
    Replies: 3
    Last Post: July 29th, 12:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139