Menubar in actionscript

Can anyone point me in the right direction if I wanted to create a menubar in actionscript?

No sorry it didn't. Maybe we can build off this though, because it is kind of working, I just need to figure out how submenu items are going to be added.
var ob:Object = new Object();
ob.label = "test";
ob.name = "hi";
arr.push(ob);
ob = new Object();
ob.label = "test2";
arr.push(ob);
]]>
</mx:Script>
<mx:MenuBar id="menu" dataProvider="{arr}" fontSize="16" fontThickness="2" color="0xFFFFFF"
rollOverColor="0xFF0000" fillColors="[0x000000, 0x666666]"/>

Similar Messages

  • Howto enable disable menubar items in actionscript

    Hello,
    My problem is that i want to enable/disable buttons in a
    menubar according to the loaded page.
    So what i did was when the user clicks on the menubar, it
    triggers a function. Inside that function there will become a check
    on which page is at front. According to that page i am gonna set
    menuitems on and off.
    Thats the idea i had, so now my problem.
    I first try to create a simple solution like my code beneath.

    I'd suggest changing things around a bit. See if the
    following works for you. The clickHandler() method has the syntax
    you're looking for.
    TS

  • MenuBar component - probs with menuitem heights

    Hi all,
    I'm new here and relatively new to Flash - I hope my question
    doesn't seem too silly for pros ;)
    I posted my problem in the ActionScript.org Forums but didn't
    get an answer so please excuse my cross-posting...
    In my application (fla-file executed as projector) I want to
    include a menubar with different menuitems, submenus etc. I have a
    xml-file with some menuitems and add some menuitems dynamically
    during runtime. That works so far: my menubar is visible with the
    menuitems it should have. (BTW (if that's important): I use the
    Sample-Theme.)
    Since the application should be used by older people or
    handicapped persons, I have to use a bigger fontSize than the
    default 10pt. But when I change the fontSize, the cellheights of
    the menuitems are too small (tails of the letters aren't
    displayed).
    So how can I change the height of the menuitems that
    everything is displayed correctly?
    Any suggestions? Did anybody have the same or a similar
    problem before and knows how to solve it or to work around?
    If there are any questions just ask...
    Perhaps you can find a mistake in my code below (it's not my
    original code because the menu is created dynamically with xml, but
    I don't think that my problem is dependent on that part ):
    ---

    You might want to ask on the Flash Builder forum.

  • ArrayList -- MenuBar Data Provider

    Hello everyone,
    I have a remote service that provides an array list
    containing a menu structure.
    But since its just a List i would still have to rework the
    structure for the menubar container to get the child-structure
    right.
    Can anyone tell me how i would access the ArrayList and
    rework it in ActionScript?
    Or maybe there is a way to make the Service send something
    other than an ArrayList so i have the DataProvider in the right
    format? Which format would i have to use? is it possible to just
    that an xml string and use that as data provider?
    Well thx a lot in advance for any hints you guys have for me.

    First, you do not have an "ArrayList". There is no such data
    type in Flex.
    What is the data service? What RPC protocol are you using in
    Flex to access it? What is your resultFormat?
    If you can stick with XML all the way through it will be
    simpler.
    Tracy

  • OSX Native MenuBar in Adobe AIR?

    Hi,
    I'd planning a new app for Desktop (Windows and Mac). In the Mac version I need to setup a osx menubar icon with its menus and items. I think this is not supported right now on Adobe AIR 13 so I'd want to ask here if there's an ANE mac extension that I could use that provides a hook to create the menubar osx icon and the menu with the options.
    If there's no such ANE, could you let me know if this is something that could be done in such way? or let me know if there's no option right now unless I go to native osx development.
    Thanks in advance.
    Carlos

    You're not talking about the DockIcon, are you?
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/DockIcon. html
    EDIT: Ah, you're talking about that bar at the top of the screen... sorry not very familiar with Mac. I'm guessing you already saw this post: http://stackoverflow.com/questions/9885275/air-application-on-the-menubar
    -Aaron

  • How to remove or change wipe effect in MenuBar?

    Does anyone know how to remove or change the default wipe
    effect in Flex 3's MenuBar? I've seen several mentions online about
    an openDuration property in the Menu class, but not in MenuBar. I
    would greatly prefer to have either no effect or just a very brief
    fade.
    A solution in either MXML or ActionScript would be greatly
    appreciated.
    Thanks very much!
    Mike Laurence

    We had an old version of Dreamweaver (DW-MX) in which I have found the layer. It apears to be an image made in Photoshop.
    The way I solved the problem now is that I deleted the layer in DW-MX and made a new background image. I am no pro, just an amateur
    Anyway, thank you very much for your fast reply and the offer to help me out this problem.

  • How can I convert an ActionScript 2 website to ActionScript3?

    I have a website which currently uses Action Script 2.
    When I change the Publish settings from Flash 7 to Flash 9
    and from ActionScript 2 to ActionScript 3, then publish the file, I
    get the following warning:
    WARNING: Actions on button or MovieClip instances are not
    supported in ActionScript 3.0. All scripts on object instances will
    be ignored.
    What can I do to correct this error?
    Is there a simple tutorial that explains how to make the
    changes?
    I subscribe to Lynda.com but I haven't seen useful there.
    I should warn you that I am a beginner when it comes to
    coding.
    Thank you

    Hi NickLW,
    In AS3 there's (like the error mentions) no attaching script
    to
    instances directly. You probably have something like:
    on(release){
    gotoAndPlay( 5 );
    well, atleast the "on( something )" part...
    That's a nono in AS3.
    You'd have to change it to code in a keyFrame in the timeline
    like:
    my_btn.addEventListener( MouseEvent.CLICK, onClick );
    function onClick( e:MouseEvent )
    gotoAndPlay( 5 )
    where my_btn is the instancename of the button.
    Look for migration from as2 to as3 in available resources
    (like:
    http://www.mandalatv.net/fcny/)
    Sure there's no mention on the Lynda courses?
    NickLW wrote:
    > I have a website which currently uses Action Script 2.
    > When I change the Publish settings from Flash 7 to Flash
    9 and from
    > ActionScript 2 to ActionScript 3, then publish the file,
    I get the following
    > warning:
    >
    > WARNING: Actions on button or MovieClip instances are
    not supported in
    > ActionScript 3.0. All scripts on object instances will
    be ignored.
    >
    > What can I do to correct this error?
    > Is there a simple tutorial that explains how to make the
    changes?
    > I subscribe to Lynda.com but I haven't seen useful
    there.
    > I should warn you that I am a beginner when it comes to
    coding.
    >
    > Thank you
    >
    Manno Bult
    http://www.aloft.nl

  • Can you show applications open directly in menubar instead of dock?

    Hi there
    I want to disable dock totally
    But I want to get the functionality in my menu bar
    So i want to show icons of the apps which are open (or at least favourite apps), directly on the menubar
    I don't want them in a folder, I already have an app which does that called xMenu
    I want the actual icons of the Favourite/IfPossible:OPEN apps to directly appear in menubar
    Is there anything that can get some/all of this functionality?

    Well, there probably is; however, a word of caution: the Menu bar is controlled by the System and it may have undesirable results changing system behavior.
    What is it about the dock that bothers you?
    I have all the apps I use on a regular basis in the dock - not a folder, mind you - alias icons to the apps themselves which all open with one click. I rarely use the system supplied Applications folder in the dock. At last count, I had almost 60 app icons in the dock, which is minimized with significant magnification - I have them organized so I can usually hit the right one without having to search. You can also check "automatically show and hide the Dock" so it'll only show itself when moving the cursor over the area.

  • The menubar will not display in full screen

    Hi.
    I have a strange problem in fullscreen mode, on my Macbook pro 15"
    I LOVE fullscreen, and infact the next macbook I will get is the 11" air because of its size and because full screen is so nice to work with.
    But I have a strange problem which I can't find a solution for.
    Suddenly the menubar will not display it self when I move the mouse to the top of the screen. The only way I can access the menu bar is by exiting full screen (ctrl + Cmd + F) and the toggel it back on after I have used the menubar
    This actually makes fullscreen mode useless and its driving me nuts, because this should not happen on Apple software. I would expect these sorts of behaviour on windows but not in osx.
    Anybody have a hint about what to do?

    https://discussions.apple.com/thread/3881124?start=0&tstart=0     <<<<< GO THERE
    Try this:  make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.

  • Can't access object using "id" or "name" if created with actionscript

    How can you register an instance of an object with actionscript so that it's id or name value is accessible?
    I included a simple example where a Button is created using mxml and in the same way it is created using actionscript.  The actionscript object is inaccessible using it's "id" and "name" property.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationComplete="application1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                protected function application1_creationCompleteHandler(event:FlexEvent):void
                    import spark.components.Button;
                    var asBtn:Button = new Button();
                    asBtn.label = "actionscript";
                    asBtn.x = 200;
                    asBtn.id = "asButton";
                    asBtn.name = "asButtonName";
                    addElement(asBtn);
                    trace("mxmlButton="+this["mxmlButton"].label); // returns: mxml  label
                    //trace("mxmlButton="+this["asButton"].label); // returns runtime error: ReferenceError: Error #1069: Property asButton not found on TestId and there is no default value.
                    //trace("mxmlButton="+this["asButtonName"].label); // returns runtime error: ReferenceError: Error #1069: Property asButtonName not found on TestId and there is no default value.
            ]]>
        </fx:Script>
        <s:Button
            id="mxmlButton"
            label="mxml label"
            alpha="0.8"/>
    </s:Application>

    Hi Dan,
    It is a very rare occurrence when I miss not being able to access an object (object property, really) using the ["name"] notation for objects created using actionscript.
    In MXML the compiler is conveniently adding an attribute to the class with the same name as the id, so you can conveniently refer to it using the [] notation. While we explicitly specify an application container to use, the MXML compiler creates a custom container which is a derivative of the base container and to that it adds properties for the children declared in MXML. I guess it also effectively calls "addElement" for us when  the container is being constructed.
    Your example assumes that using "addElement" to add the button to the application container is the same as declaring a variable (ie property ). It isn't, so there's no point in looking for an property of the name "as3Button" using the [] notation, because it doesn't exist. The container is managing a collection of children in it's display list and that's not the same as being accessible as properties of the container.
    Generally speaking, accessing properties using the ["name"] syntax isn't necessary.
    Paul
    [edit: you may wonder why "addElement" doesn't conveniently also add the "id" attribute to be an property of the container class. Unfortunately, it can't because the container class would need to be dynamic and it's not. A further complication would be that adding properties at runtime would invite naming clashes at runtime with associated mayhem. MXML can do this because the compiler generates the class and can trap name duplication at compile time.
    Great question, BTW.
    -last edit changed my "attributes" to be "properties" in line with Adobe's terminology]

  • Is there a way of changing the alpha value of a symbol in its own timeline without ActionScript

    I'm trying to make an animated banner ad where radio waves emanate from a device as they fade in and fade out.
    I got it working, then realized I'd like the radio wave animation to loop repeatedly while the text in the ad comes in and out, so I thought maybe it should be a symbol and have the animation take place in its own timeline.
    Problem is, when I make the symbol and double click to enter its timeline, the color effect menu disappears.
    I don't feel comfortable in ActionScript yet. Is there no other way to do what I want?
    Can I create the radio waves as a separate animation file, then import it into the main animation?

    You should be able to make seperate keyframes and then modify the alpha of any MovieClip or Graphic objects within that keyframe. After that right click somewhere between the keyframes on the timeline and select "Create Classic Tween".
    NOTE: You have to have the keyframe selected on the timeline to be able to modify properties. So if you have a keyframe on frame 1, frame 10 and frame 20 set the alpha on frame 1 at 100%, frame 10 at 0% and frame 20 at 100% and it will fill in the blanks.
    EDIT:
    If the objects in your inner symbol are not a MovieClip or Graphic select all and then Right Click and select "Convert to Symbol" to make them one.

  • Passing null/empty values from a actionscript VO to a Coldfusion ORM object

    This is the situation.
    If you have an actionscript VO that binds to a Coldfusion ORM object via the RemoteClass metadata and some of the values are not set, null, or empty strings and you pass it from Flex to Coldfusion then the Coldfusion deserialization barfs saying the values are not acceptable date values (for type="date") or valid emails (for validation="email") or other such validations, even if required="false" on the property.
    For instance, if you have the following actionscript VO:
    package vo
        [RemoteClass(alias="com.companyname.Person")]
        [Bindable]
        public class Person
            public var person_id:Number;
            public var last_name:String;
            public var first_name:String;
            public var email:String;
            public var created_date:date;
         public function Person() {}
    And you have the corresponding Coldfusion component:
    <cfcomponent displayname="person" output="false"
        alias="com.companyname.Person"
        schema="dbo" persistent="true"
        table="PERSON">
        <cfproperty name="person_id" type="numeric" fieldtype="id" validate="integer" required="true" column="PERSON_ID"/>
        <cfproperty name="last_name" type="string" column="LAST_NAME" required="true"/>
        <cfproperty name="first_name" type="string" required="true" column="FIRST_NAME"/>
        <cfproperty name="email" type="string" validate="email" required="false" column="EMAIL"/>
        <cfproperty name="date_created" type="date" required="false" column="DATE_CREATED"/>
    </cfcomponent>
    Then if you pass the actionscript VO as is to Coldfusion, the deserialization complains that you do not have a valid email or a valid date for date_created.  This is bad, bad, bad.  Essentially if you have a validation of certain types (email being one) or a date property, or probably some other cases, then you essentially can not make it not required, it automatically makes it required because the Coldfusion serializer considers null/empty values as invalid dates or emails.  But the serializer should not care for values that are not required, there has to be a way to pass null/empty values to these data types, but apparently there's not.  If you pass an empty string ("") you still have the same problem.  I know Coldfusion does not have null values, but there has to be a way to do this, otherwise it defeats the purpose of having required="false" and some kind of validation on the property.
    There seems to be two ways around it.  One is to override the implicit setters for the properties on the Coldfusion side and check for 0 length values yourself, then set the property if it is not, or create your own validation routine.  I ended up creating my own validation function since I didn't want to have to write a setter function for everyone of these cases and I can pass back user friendly validation messages.
    Have other people encountered this problem?  How have you gotten around it?  Thanks.

    I realize that I didn't clarify that I am using ColdFusion
    for getting the data. This class was generated by the Create CFC
    wizard in Flex Builder.
    package com.generated
    [Managed]
    [RemoteClass(alias="components.generated.clients.Clients")]
    public class Clients
    public var clientid:Number = 0;
    public var clientfirstname:String = "";
    public var clientlastname:String = "";
    public var clientaddress1:String = "";
    public var clientaddress2:String = "";
    public var clientcity:String = "";
    public var clientstate:String = "";
    public var clientzip:String = "";
    public var clientphone:String = "";
    public var clientemail:String = "";
    public function Clients()
    }

  • How do I use Embed with an environment variable in an Actionscript AIR project Flash Builder 4.7

    I am using Flash Builder 4.7 to build an Actionscript AIR project.  The project embeds a number of png files from my local directory and I have been using absolute paths which all works fine.
    I have a laptop with which I want to start developing the same project - I set up a git repository that both the laptop and main pc can pull from and so I can get the source where I need it and push it back to the central repository.
    My problem is that the absolute paths for the embed commands don't work on the laptop as it has a different filesystem setup (Windows 8 with one drive as opposed to Windows 7 with a SSD and a data drive).  I thought the solution would be as easy as using an environment variable to specify the path which could then point to a different physical directory on both machines, i.e:
    [Embed(source = "DEVELOPER_RESOURCES/graphics/are/here.png"]
    I did a bit of research and there was quite a lot mentioned about setting up resource directories using path variables which I worked through but I just can't get it to compile.  The Actionscript compiler just won't find the png files however I specify the path.  I tried something with a FLEX project and the compiler didn't complain but I think this is because the compiler for FLEX uses a different convention.
    [Embed(source ="/Project Name/DEVELOPER_RESOURCES/graphics/are/here.png"]  works with FLEX but not Actionscript.
    So does anyone have a recipe for using the Embed command referencing assets using an environment variable that works across multiple machines with different file structures?

    I managed to find a solution on Windows which was to use symlinks and absolute paths.  You an basically point one directory to another so I did something like:
    mklink c:\developer_resources c:/the/local/path/to/my/resources
    and then reference all resources as c:\developer_resources\...
    Now as long as a developer machine has the right link (from c:\developer_resources to the place where the resources are kept) then it seems to work. 
    This doesn't however work for Mac and certainly isn't a solution for passing files between Mac and windows

  • Creating a Popup in ActionScript vs Creating a Popup in MXML

    Hello there
    I think I need a little help with a  couple of items. I'm using the Popup Library version 1.11 and I'm trying  to open up a Popup (with an associated presentation model) which I have  defined as follows.
    view.popup.EditSection.mxml
    view.popup.EditSectionPM.as
    the  view that opens the popup class (EditSection)  dows the following in  MXML, and it looks right, but it gives me limited access to the  reference of the popup window. With MXML it looks like this  http://grab.by/6Oaf
            <popup:PopUpFactory id="editSectionPopup" reuse="true" modal="true">
                 <fx:Component>
                     <popupWindows:EditSection/>
                 </fx:Component>
                 <popup:behaviors>
                     <spark:ZoomAndFadeBehavior duration="1000"/>
                     <behavior:KeepCenteredBehavior/>
                     <behavior:CenterBehavior/>
                     <popup:AddPopUpToParsleyContext />
                 </popup:behaviors>
             </popup:PopUpFactory>
    instead of  this, I've cobbled together the following ActionScript, but the popups  look VASTLY different when they open. Here is the ActionScript.. the  creationComplete runs the initializePopup() and the button click runs  the openPopup().. this version looks like http://grab.by/6Oaz when  opened.
    It doesnt seem to honor the height, width, etc  of the Class defining the popup, and when I click the different states,  I get errors indicating that no such states exist... though they exist  in the class
    question: Why might Cairngorm be opening up the wrong (generic?) TitleWindow? What am i doing wrong here?
        <fx:Script>
             <![CDATA[
                 import com.adobe.cairngorm.popup.PopUpFactory;
                 import com.adobe.cairngorm.popup.PopUpWrapper;
                 import com.adobe.cairngorm.popup.behavior.CenterBehavior;
                 import com.adobe.cairngorm.popup.behavior.KeepCenteredBehavior;
                 import com.adobe.cairngorm.popup.behavior.spark.ZoomAndFadeBehavior;
                 import com.company.psa.docbuilder.adhoc.view.editsection.EditSection;
                 import mx.collections.ArrayCollection;
                 import mx.controls.Alert;
                 private var wrapper:PopUpWrapper;
                 private var factory:PopUpFactory;
                 private var zoomAndFadeBehavior = new ZoomAndFadeBehavior();
                 public function initializePopup():void
                     var myEditSectionPopup:EditSection;
                     var myBehaviors:Array = new Array();
                     var myZAF = new ZoomAndFadeBehavior();
                     myBehaviors[0] = myZAF; // How do I set the duration?
                     myBehaviors[1] = new CenterBehavior()
                     myBehaviors[2] = new KeepCenteredBehavior();
                     factory = new PopUpFactory();
                     factory.popup = new ClassFactory(EditSection);
                     factory.reuse = false;
                     factory.modal = true;
                     factory.behaviors=myBehaviors;
                     // How do I reference the opened window?
                 public function openPopup () :void
                     factory.open = true;
             ]]>
         </fx:Script>
    Here is the definition of the EditSection.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:spicefactory="http://www.spicefactory.org/parsley"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    enabled="true"
                    width.EditSectionState="500"
                    height.EditSectionState="350"
                    width.YesNoCancelState="320"
                    height.YesNoCancelState="200"
                    width.YesNoState="320"
                    height.YesNoState="200"
                    title="{pm.windowTitle}"
                    currentState="{pm.viewState}"
                    creationComplete="init()">
        <fx:Metadata>
             [Event(name="close", type="mx.events.CloseEvent")]
         </fx:Metadata>
        <fx:Script>
             <![CDATA[
                 import mx.binding.utils.BindingUtils;
                 import mx.controls.Alert;
                 import mx.core.mx_internal;
                 import mx.events.CloseEvent;
                [Inject]
                 [Bindable]
                 public var pm:EditSectionPM;
                protected function closeHandler(event:CloseEvent):void
                     pm.closeHandler(event);
                     trace("EditSection is closing");
                public function init():void
             ]]>
         </fx:Script>
         <s:states>
             <s:State name="EditSectionState"/>
             <s:State name="YesNoCancelState"/>
             <s:State name="YesNoState"/>
         </s:states>
        <fx:Declarations>
             <spicefactory:Configure/>
         </fx:Declarations>
        <!-- Define the transition to animate the change of view state. -->
         <s:transitions>
             <s:Transition fromState="EditSectionState">
                 <s:Parallel>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Parallel>
             </s:Transition>
             <s:Transition fromState="YesNoCancelState">
                 <s:Sequence>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Sequence>
             </s:Transition>
             <s:Transition fromState="YesNoState">
                 <s:Sequence>
                     <mx:Resize target="{this}"
                                duration="500"/>
                 </s:Sequence>
             </s:Transition>
         </s:transitions>
        <s:Label text="Hello There World"
                  left="10"
                  right="10"
                  top="10"
                  verticalAlign="middle"
                  textAlign="center"
                  click="pm.labelClickHandler(event)"/>
        <mx:ControlBar width="50%"
                        left="10"
                        bottom="10"
                        height="40"
                        horizontalAlign="left"
                        verticalAlign="middle">
             <mx:Button label="Cancel"
                        width="120"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
             <mx:Button label="Reset to Default"
                        width="140"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
         </mx:ControlBar>
         <mx:ControlBar width="50%"
                        right="10"
                        bottom="10"
                        height="40"
                        horizontalAlign="right"
                        verticalAlign="middle">
             <mx:Button label="Save"
                        width="140"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="EditSectionState"/>
             <mx:Button id="yesButton"
                        label="Yes"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState,YesNoState"/>
             <mx:Button id="noButton"
                        label="No"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState,YesNoState"/>
             <mx:Button id="cancelButton"
                        label="Cancel"
                        width="60"
                        click="dispatchEvent( new CloseEvent( CloseEvent.CLOSE ) )"
                        includeIn="YesNoCancelState"/>
         </mx:ControlBar>
         <s:RadioButton id="editSectionsCheckbox"
                        y="30"
                        label="Edit Sections"
                        selected="true"
                        click="pm.editSectionStateClickHandler(event)"
                        y.YesNoCancelState="24"
                        y.YesNoState="24"
                        width.YesNoState="99"
                        horizontalCenter.EditSectionState="-2"
                        y.EditSectionState="30"
                        width.EditSectionState="95"
                        horizontalCenter.YesNoCancelState="-7"
                        horizontalCenter.YesNoState="-3"/>
         <s:RadioButton id="yesNoCancelCheckbox"
                        y="56"
                        label="Yes/No/Cancel"
                        click="pm.yesNoCancelStateClickHandler(event)"
                        y.YesNoCancelState="50"
                        y.YesNoState="50"
                        horizontalCenter.EditSectionState="-1"
                        y.EditSectionState="56"
                        horizontalCenter.YesNoCancelState="-3"
                        horizontalCenter.YesNoState="-3"/>
         <s:RadioButton id="yesNoCheckbox"
                        y="76"
                        label="Yes/No"
                        click="pm.yesNoStateClickHandler(event)"
                        width="99"
                        y.EditSectionState="83"
                        horizontalCenter.EditSectionState="-1"
                        horizontalCenter.YesNoCancelState="-3"
                        horizontalCenter.YesNoState="-3"/>
    </s:TitleWindow>
    Here is the definition of EditSectionPM.as
    /*   Copyright 2010                                                           */
    /*   All rights reserved.                                                     */
    package com.company.psa.docbuilder.adhoc.view.editsection
         import com.company.psa.docbuilder.adhoc.business.IDocumentConfigurationReceiver;
         import com.company.psa.docbuilder.core.business.DocumentConfiguration;
         import flash.events.MouseEvent;
         import mx.controls.Alert;
         import mx.events.CloseEvent;
         public class EditSectionPM implements IDocumentConfigurationReceiver
            [Bindable]
             public var height:int=300;
            [Bindable]
             public var message:String="Spark Popup";
            [Bindable]
             public var viewState:String="EditSectionState";
            [Bindable]
             public var width:int=400;
             [Bindable]
             public var windowTitle:String="Edit: ";
             [Bindable]
             public var documentConfiguration:DocumentConfiguration;
             public var isDirty:Boolean=false;
             public var cancelVisible:Boolean=false;
             // Implementing the notifier receiver design pattern
             public function setDocumentConfiguration(argDocumentConfiguration:DocumentConfiguration):void
                 this.documentConfiguration=argDocumentConfiguration;
             public function closeHandler(event:CloseEvent):void
                 trace("Close was clicked");
             public function cancelHandler(event:CloseEvent):void
                 trace("Cancel was clicked");
             public function resetHandler(event:CloseEvent):void
                 trace("Reset was clicked");
             public function yesHandler(event:CloseEvent):void
                 trace("Yes was clicked");
             public function noHandler(event:CloseEvent):void
                 trace("No was clicked");
             public function editSectionStateClickHandler(event:MouseEvent):void
                 trace("Edit Section state selected (setting this in the PM)");
                 this.viewState="EditSectionState";   
             public function yesNoCancelStateClickHandler(event:MouseEvent):void
                 trace("Yes/No/Cancel state selected (setting this in the PM)");
                 this.viewState="YesNoCancelState";
             public function yesNoStateClickHandler(event:MouseEvent):void
                 trace("Yes/No/Cancel state selected (setting this in the PM)");
                 this.viewState="YesNoState";   
             public function labelClickHandler(event:MouseEvent):void
                 trace("Label was clicked");
                 Alert.show("The Label"+event.toString() ,"You Clicked");

    Hi John,
    If you're using Flex 4, the PopUpFactory isn't needed anymore, you can use the PopUpWrapper for everything. More info here: https://sourceforge.net/adobe/cairngorm/wiki/HowToUseCairngormPopup/
    What's the reason you need a reference to the popup window? I ask because one very common reason is that users want to open and close it from elsewhere (i.e. a Presentation Model). For that, the popup library offers bindable property open, so all your behaviour object needs to do is to bind a Boolean to it and you don't need an extra view reference of the actual popup window. However, you could also get that if you listen to one of the open/close type events; inside each event object there's a popup property that points to the actual popup window. Regarding your AS usage, I didn't see anything wrong at first sight but maybe compare it the AS sample in the PopupTest project? But first, check if you really need to do it in AS as the MXML examples in PopupTest and on the how-to wiki read simpler IMHO.But also, let us know if it does'nt satisfy your use case.
    Alex

  • Flex 3 vs Flex 4 Preprocessor directives and code behind (External Actionscript file)

    I have a framework that I've built that I want to use on Flex3 and Flex4.
    I've added pre-processor directives as per this link (http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html) and got my Flex 4 code to compile nicely.
    I then went to flex 3 and discovered my sub-class of Application wouldn't compile because it was based off of spark. No problem, I'll add in a directive.
    Except now my overridden class has duplicate code, specific to which SDK it is using.
    No problem, I'll put all of the application class code in an Actionscript file and include it in both Application class declarations for each directive.
    It works nicely in Flex 3, so I went to Flex 4, tried to compile and now I'm getting compiler errors saying things such as "The (private|public|protected) attribute may only be used on class property definitions." and "The (private|public|protected) attribute can only be used inside a package.
    This same file works in Flex 3, but not in Flex 4.
    What can I do to make the code compile in both places?
    I'll work on a simple case so I can upload some code.

    Nevermind.
    I got around this issue by renaming my sub-classed Application to "...Application".
    Now I can use a directive to specify an import statement for the extends Application portion rather than specifiing the fully qualified spark.components.Application or mx.core.Application.
    Lame - but done.

Maybe you are looking for