Using a DropDownList in a DataGrid, both with dynamically loaded content

I just bought FlashBuilder 4.5 and even though I have been using ActionScript for years, I am having the hardest time to solve a seemingly simple task:
I have a database table with names of employees:
id
name
departmentid
1
Janet Jackson
2
2
Frank Zappa
2
3
John Travolta
1
in another table I have the departments
id
Department
1
Acting Department
2
Music Department
What I want is a DataGrid with a DropDownList itemRenderer for the Department so that I can selected the Department by name and not by id. This should be a no-brainer (and with HTML and PHP I have done that hundreds of times), but with Flex I can not figure out how to do this. This is what I have done so far:
Created the DataGrid, generated the database service and dragged it to the datagrid to bind the data. Works.
Then I created an itemRenderer for departmentid
In the department itemRenderer I dragged a DropDownList element, created a database service for the departments and dragged it onto that to get the databinding.
So far, so good. When I start it, I have a populated datagrid with a DropDownList that shows all available departments when I click on it.
What I need, of course, is that the Department DropDownList now shows the Department of the Employee row. When I change the Department in the DropDownList, it should update the Employee Database table.
I literally spend now days on trying to figure this out and can't find anything on the Internet that would help me. If you could give me some advise or even show me how the code needs to look, it would be GREATLY appreciated.
I am pasting here also the code:
<?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"
                  xmlns:employeeservice="services.employeeservice.*"
                  width="982" height="380" minWidth="955" minHeight="600">
     <fx:Script>
          <![CDATA[
               import mx.controls.Alert;
               import mx.events.FlexEvent;
               protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getAllEmployeeResult.token = employeeService.getAllEmployee();
          ]]>
     </fx:Script>
     <fx:Declarations>
          <s:CallResponder id="getAllEmployeeResult"/>
          <employeeservice:EmployeeService id="employeeService"
                                                   fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                   showBusyCursor="true"/>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <s:DataGrid id="dataGrid" x="52" y="67" width="455"
                    creationComplete="dataGrid_creationCompleteHandler(event)" editable="true"
                    requestedRowCount="4">
          <s:columns>
               <s:ArrayList>
                    <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                    <s:GridColumn dataField="firstname" headerText="firstname"></s:GridColumn>
                    <s:GridColumn dataField="lastname" headerText="lastname"></s:GridColumn>
                    <s:GridColumn dataField="departmentid" editable="false" headerText="departmentid"
                                     itemRenderer="components.DepartmentDropDownList"></s:GridColumn>
               </s:ArrayList>
          </s:columns>
          <s:typicalItem>
               <fx:Object id="id1" departmentid="departmentid1" firstname="firstname1"
                            lastname="lastname1"></fx:Object>
          </s:typicalItem>
          <s:AsyncListView list="{getAllEmployeeResult.lastResult}"/>
     </s:DataGrid>
</s:Application>
Here the code of the itemRenderer:
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         xmlns:departmentservice="services.departmentservice.*"
                         width="172" height="34" clipAndEnableScrolling="true">
     <fx:Script>
          <![CDATA[
               import mx.controls.Alert;
               import mx.events.FlexEvent;
               override public function prepare(hasBeenRecycled:Boolean):void {
                    lblData.text = data[column.dataField]
               protected function dropDownList_creationCompleteHandler(event:FlexEvent):void
                    getAllDepartmentResult.token = departmentService.getAllDepartment();
          ]]>
     </fx:Script>
     <fx:Declarations>
          <s:CallResponder id="getAllDepartmentResult"/>
          <departmentservice:DepartmentService id="departmentService"
                                                        fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                        showBusyCursor="true"/>
     </fx:Declarations>
     <s:Label id="lblData" top="9" left="7"/>
     <s:DropDownList id="dropDownList" x="34" y="5" width="128"
                         creationComplete="dropDownList_creationCompleteHandler(event)"
                         labelField="department">
          <s:AsyncListView list="{getAllDepartmentResult.lastResult}"/>
     </s:DropDownList>
</s:GridItemRenderer>

I just bought FlashBuilder 4.5 and even though I have been using ActionScript for years, I am having the hardest time to solve a seemingly simple task:
I have a database table with names of employees:
id
name
departmentid
1
Janet Jackson
2
2
Frank Zappa
2
3
John Travolta
1
in another table I have the departments
id
Department
1
Acting Department
2
Music Department
What I want is a DataGrid with a DropDownList itemRenderer for the Department so that I can selected the Department by name and not by id. This should be a no-brainer (and with HTML and PHP I have done that hundreds of times), but with Flex I can not figure out how to do this. This is what I have done so far:
Created the DataGrid, generated the database service and dragged it to the datagrid to bind the data. Works.
Then I created an itemRenderer for departmentid
In the department itemRenderer I dragged a DropDownList element, created a database service for the departments and dragged it onto that to get the databinding.
So far, so good. When I start it, I have a populated datagrid with a DropDownList that shows all available departments when I click on it.
What I need, of course, is that the Department DropDownList now shows the Department of the Employee row. When I change the Department in the DropDownList, it should update the Employee Database table.
I literally spend now days on trying to figure this out and can't find anything on the Internet that would help me. If you could give me some advise or even show me how the code needs to look, it would be GREATLY appreciated.
I am pasting here also the code:
<?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"
                  xmlns:employeeservice="services.employeeservice.*"
                  width="982" height="380" minWidth="955" minHeight="600">
     <fx:Script>
          <![CDATA[
               import mx.controls.Alert;
               import mx.events.FlexEvent;
               protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getAllEmployeeResult.token = employeeService.getAllEmployee();
          ]]>
     </fx:Script>
     <fx:Declarations>
          <s:CallResponder id="getAllEmployeeResult"/>
          <employeeservice:EmployeeService id="employeeService"
                                                   fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                   showBusyCursor="true"/>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <s:DataGrid id="dataGrid" x="52" y="67" width="455"
                    creationComplete="dataGrid_creationCompleteHandler(event)" editable="true"
                    requestedRowCount="4">
          <s:columns>
               <s:ArrayList>
                    <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                    <s:GridColumn dataField="firstname" headerText="firstname"></s:GridColumn>
                    <s:GridColumn dataField="lastname" headerText="lastname"></s:GridColumn>
                    <s:GridColumn dataField="departmentid" editable="false" headerText="departmentid"
                                     itemRenderer="components.DepartmentDropDownList"></s:GridColumn>
               </s:ArrayList>
          </s:columns>
          <s:typicalItem>
               <fx:Object id="id1" departmentid="departmentid1" firstname="firstname1"
                            lastname="lastname1"></fx:Object>
          </s:typicalItem>
          <s:AsyncListView list="{getAllEmployeeResult.lastResult}"/>
     </s:DataGrid>
</s:Application>
Here the code of the itemRenderer:
<?xml version="1.0" encoding="utf-8"?>
<s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/mx"
                         xmlns:departmentservice="services.departmentservice.*"
                         width="172" height="34" clipAndEnableScrolling="true">
     <fx:Script>
          <![CDATA[
               import mx.controls.Alert;
               import mx.events.FlexEvent;
               override public function prepare(hasBeenRecycled:Boolean):void {
                    lblData.text = data[column.dataField]
               protected function dropDownList_creationCompleteHandler(event:FlexEvent):void
                    getAllDepartmentResult.token = departmentService.getAllDepartment();
          ]]>
     </fx:Script>
     <fx:Declarations>
          <s:CallResponder id="getAllDepartmentResult"/>
          <departmentservice:DepartmentService id="departmentService"
                                                        fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                        showBusyCursor="true"/>
     </fx:Declarations>
     <s:Label id="lblData" top="9" left="7"/>
     <s:DropDownList id="dropDownList" x="34" y="5" width="128"
                         creationComplete="dropDownList_creationCompleteHandler(event)"
                         labelField="department">
          <s:AsyncListView list="{getAllDepartmentResult.lastResult}"/>
     </s:DropDownList>
</s:GridItemRenderer>

Similar Messages

  • Dynamically load content by date using xml

    i would like to load content by date using xml. meaning if i
    have 5 upcoming social events listed, i want them to dynamically
    drop off from my webpage as the event date passes. i would like to
    use the built in spry xml dataset functionality, but don't have to.
    i can't seem to find a way to get the server date and then compare
    it to a date in a xml node. this seems simple, but i can't seem to
    find a tutorial that does not get crazy with all kinds of
    code.

    Have the column headings (which the user clicks to sort by
    that column) as
    links back to the main page, with the sort as a url parameter
    eg
    www.mysite.com/mypage.php?sort=name
    www.mysite.com/mypage.php?sort=date
    etc
    Then in your recordset, change the code from
    $sql = "SELECT * FROM table ";
    to
    switch($_GET['sort']){
    case "date":
    $sql = "SELECT * FROM table ORDER BY date DESC";
    break;
    case "name":
    $sql = "SELECT * FROM table ORDER BY name DESC";
    break;
    You`ll need to change the above to suit your needs obviously,
    but the above
    shows the principles that you need to use.
    So you use the same page for each sort, but the SQL to
    retrieve the records
    in the order you want changes dynamically.
    Gareth
    http://www.phploginsuite.co.uk/
    PHP Login Suite V2 - 34 Server Behaviors to build a complete
    Login system.

  • Remote debugging an executable with dynamically loaded subpanel VIs

    All,
    A colleague of mine is attempting to perform remote debugging of an executable he has inherited. It includes subpanels that show dynamically loaded VIs. When connecting with the remote debugger, the main executable shows fine, but the dynamically loaded VIs are not showing their front panels. They appear ok on the remote PC where the executable is running, but they don't appear on his laptop from where he is running the debugger.
    I don't have access to LabVIEW currently, and he cannot get this to work, so I thought I'd ask the community this generic question:
    "Is it possible to remotely debug a LabVIEW executable with subpanels that show dynamically loaded subVIs?"
    Technically he can see and probe the block diagram of the main executable, but the subpanels are blank where the dynamcally loaded subVI front panel should show, making it impossible to interact with the program.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    Thanks Josh. Does this issue have a CAR number I can tag?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Security Issues with Dynamic Loading

    Hi,
    I am trying to run a simple RMI example that uses dynamic class loading but I am hitting a problem I cannot get around - can anyone help?
    The problem I am getting is that when I run my client program I get the exception listed at the bottom of my post.
    I have the following in my server class called WarehouseServer:
       System.setProperty("java.security.policy", "server.policy"); 
       System.setSecurityManager(new SecurityManager());  I have the a server.policy file located in the same folder as my server class:
        grant {   
            permission java.security.AllPermission "", "";   
        };   I run my server using the following command:
    *{noformat}java -Djava.rmi.server.codebase=http://localhost:8080/ WarehouseServer{noformat}*
    I have also tried running the server using this command:
    *{noformat}java -Djava.rmi.server.codebase=http://localhost:8080/ -Djava.security.policy=server.policy WarehouseServer{noformat}*
    But on both occasions I get the same exception when running my client program.
    Any idea?
    Cheers,
    Sean.
    =====================================================================
    Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.lang.ClassNotFoundException: Book (no security manager: RMI class loader disabled)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
    at $Proxy0.getProduct(Unknown Source)
    at WarehouseClient.main(WarehouseClient.java:32)
    Caused by: java.lang.ClassNotFoundException: Book (no security manager: RMI class loader disabled)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
    ... 4 more

    Thanks EJB. You are correct! I only had the security manager and policy set up in the server; I didn't have it set up in the client. God these RMI errors can be obscure at times.
    For anyone else that may come across it this. I was following an example from this chapter 10 of this book [url http://www.amazon.com/Core-Java-Vol-Advanced-Features/dp/0132354799/ref=sr_1_1?s=books&ie=UTF8&qid=1299739763&sr=1-1]Core Java, Vol. 2: Advanced Features, 8th Edition . The example outlines setting up the security manager and policy in the server, but fails to mention that you also need to set this up in the client.
    When you download the code associated with the book from the [url http://www.horstmann.com/corejava.html]website , you'll see that both the client and server have the security manager and policy set up.
    I actually removed the security manager and policy from the server, I left the security manager and policy in the client, and everything worked fine!

  • Challenge with dynamic rendered content

    I have a complex JSF file that I want to conditionally render a portion of the page based on a dynamic value. Here is the simplified scenario.
    <h:form>
    <h:inputHidden value="#{aRequestScopedMbean.id}"/>
    <h:outputText value="JSF rocks" rendered="#{aRequestScopedMbean.showValue}"/>
    </h:form>
    ...The JSP's mbean has an id value binding which is key to determining the return value of aRequestScopedMbean.showValue. In other words the getShowValue method uses the id to determine its return result. Unfortunately, during server side processing, it appears that during the early JSF phases (I believe the restore view phase) the framework tries to determine the result from our showValue method, but that method fails because the id has not yet been restored.
    I must be missing something as this scenario seems fairly simple. The only solution that I can devise is to put the id as a session scoped variable, that is a viable solution for this trivial case, but that won't suffice because the actual pages that I'm working with would contain too much session data.
    What am I missing?
    Thanks,
    Josh.

    I don't think you are missing anything. That's just how it works.
    The rendered component property is checked many times within the lifecycle as the lifecycle methods are applied to the component tree.
    As you already seem to know, the problem is that your showValue expression is being called before you set the id value. Here are a couple suggestions:
    1. You can try to "send" the id parameter to your managed bean as an HTTP parameter. You can then set the id property on your managed bean using the managed-property element. Something like:
    <managed-bean>
    <managed-bean-name>aRequestScopedMbean</managed-bean-name>
    <managed-bean-class>foo.aRequestScopedMbean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>id</property-name>
    <value>#{param.id}</value>
    </managed-property></managed-bean>
    The setId() method will be called right after the constructor is done and this will be before your showValue method is called.
    2. It might be possible to ask the FacesContext what phase it's in or something similar and use this information in your showValue method (although that seems very messy and prone to error)
    3. As you suggest, persist the id in session. Though, as you also point out, this has it's drawbacks as well.
    In any case, you must devise a way to populate your id value before showValue gets called.

  • Static links with dynamic Gallery content

    OK, I do not want to sound crazy with this request but it has some logic that may be usefull.
    I have the Dynamic Photo Gallery with a Dynamic List Menu from the Spry Samples and want to select the id or someway to load the Dynamic List Menu Item with a fixed link. If I have 3 Galleries.... China, Eqypt & Paris, can I not just link or use an onClick handler to select the new gallery?
    Dynamic Code:
    <select name="gallerySelect" id="gallerySelect" onchange="dsGalleries.setCurrentRowNumber(this.selectedIndex);" spry:repeatchildren="dsGalleries" spry:choose="choose">
            <option spry:when="{ds_RowNumber} == {ds_CurrentRowNumber}" selected="selected">{sitename}</option>
            <option spry:default="default">{sitename}</option>
          </select>
    Any Help would be Great!
    WBell

    <select name="gallerySelect" id="gallerySelect" onchange="dsGalleries.setCurrentRowNumber(this.selectedIndex);" spry:repeatchildren="dsGalleries" spry:choose="choose">
            <option spry:when="{ds_RowNumber} == {ds_CurrentRowNumber}" selected="selected">{sitename}</option>
            <option spry:default="default">{sitename}</option>
          </select>
    If i understand you correctly you want to use links, instead of a select.. You can do it like this:
    <ul spry:repeatchildren="dsGalleries">
         <li><a href="#{ds_RowNumber}" onclick="dsGalleries.setCurrentRowNumber(this.href.replace(/\#/g,''));">{sitename}</a></li>
    </ul>

  • Build applications with dynamic loaded subVI's as dll

    I want to build an application with some subVI's. The target would be to have an *.exe from the topVI and a seperate file for every subVI (I suppose this will then be a *.dll file)
    The topVI uses the "call by reference node" with a "type specifier VI refnum" reference.
    The path of the subVI's is read from a textfile and the subVI's are called dynamicly, all subVI's have the same connector layout.
    Until now I was not able to generate a *.exe file wich is able to dynamicly call subVI's which are not included in the *.exe file (I tried with *.vi, *.llb and *.dll versions of the subVI's).
    Building this application with all subVI's included in the *.exe is no problem and works fine, but is not what I want.
    The target would be to have the possibility to update only some subVI's without the need to build the whole application again.
    This way of working would increase the flexibility to have different combinations of versions a lot.
    I am using LV8.2.
    Is my question anyway possible and if yes can somebody tell me how?
    Thanks!

    Hello,
    A SubVI is actually what you call a sub-routine in text-based programming languages.
    So when you build an executable from a VI with SubVI's, it will simply build everything into one exe file.
    That's normal behaviour.
    If you would like to use dll's for flexibility, than you have to build VI's seperately for every dll you want to build.
    These dll's can than be called from within you main application executable.
    This practice is often used by system integrators to protect there code otherwise than a larger executable, but mainly because of easy maintenance.
    That is what I think you are also looking at.
    So what you would like to do is perfectly possible and common practice, you may only have to change your top view of the actual application.
    Best regards,
    Joeri
    National Instruments
    Applications Engineering
    http://www.ni.com/ask
    Make our forums great:
    If you like the answer, don't forget to "Kudos!".
    "Accept the Solution" if your question is answered!

  • Problems with Dynamically Loaded jpgs

    Hello all,
    I'm trying to create a dynamic flash slideshow that loads
    external jpgs (and thus can be reused). I can get my jpgs to load
    just fine but when I try to center the loaded images I run into
    problems.
    Here is my code for reference:
    quote:
    _root.createEmptyMovieClip("parentClip", 1);
    parentClip.createEmptyMovieClip("containerClip", 1);
    parentClip.containerClip.loadMovie("images/tempSlideshowImages/image2.jpg");
    When I go to get the width or height of parentClip (or
    containerClip for that matter) I get 0 no matter what I do, even
    though the image is loaded and displays just fine.
    Is there any way to load a jpg into a movie clip and then
    manipulate the movieclip normally?

    Use the MovieClipLoader class, and then use its onLoadInit
    callback to set
    your properties once the clip is available to manipulate.
    Dave -
    Adobe Community Expert
    www.blurredistinction.com
    http://www.adobe.com/communities/experts/

  • Problem with dynamically loading the dropdown list from database

    Please help me,
    i am having a jsp page which contains a form
    with a textfield ,two dropdown list
    and a submit button
    when i select a list from first drop down, second drop down has to
    be loaded from the database dynamically according to the
    selected one in the first drop down.
    i gave onselect event for the first drop down and
    gave this one
    temp=first dropdown selected value
    self.location='currentfile+query='+temp;
    after this current page is reloading, but the already existing
    values in textfield and first selected value in drop down list is
    missing.
    how to solve this problem? and the rest of the problem. i mean
    loading the data into second drop down list.
    plz help me......

    in first <selcet> tag write Onchange and submit to the jsp then the values will return in second select box.

  • MyButton with dynamically loading images

    Hello!
    I've tried to write my own button based on MovieClip. So I created a new MovieClip called MyButton. It has 3 main frames (or clue frames or... I don't know how it's called in English ): the first is for button's upState, the last two are the start and the end of press animation (I need a long animation - not just one frame). All the frames are empty.
    Then I created a class MyButton.as:
    package  {
         import flash.display.MovieClip;
         import flash.display.Loader;
         import flash.display.Bitmap;
         import flash.net.URLRequest;
         import flash.display.LoaderInfo;     
         public class MyButton extends MovieClip
              public var upState:Bitmap;
              public var downState:Bitmap;
              public var currState:Bitmap;
              public function MyButton(_upState:Bitmap, _downState:Bitmap)
                   upState = _upState;
                   downState = _downState;
                   currState = upState;
                   gotoAndStop(1);
                   addChild(currState);
              public function pressed()
                   gotoAndStop(2);
                   removeChild(currState);
                   currState = downState;
                   addChild(currState);
                   play();
              public function unpressed()
                   gotoAndStop(1);
                   removeChild(currState);
                   currState = upState;
                   addChild(currState);
    and my main class is:
    package my
         public class Main extends MovieClip
              var button_up:Loader = new Loader();
              var button_down:Loader = new Loader();
              var up : Boolean = false;
              var down : Boolean = false;
              var btn : MyButton;
              public function Main()
                   button_up.contentLoaderInfo.addEventListener(Event.COMPLETE, compUp);
                   button_up.load(new URLRequest("C:\\images\\back_up.png"));
                   button_down.contentLoaderInfo.addEventListener(Event.COMPLETE, compDown);
                   button_down.load(new URLRequest("C:\\images\\back_down.png"));
              function compUp(event:Event)
                   up = true;
                   if (up && down)
                        btn = new MyButton(Bitmap(button_up.content), Bitmap(button_down.content));
                        addChild(btn);
                        btn.addEventListener(MouseEvent.CLICK, my);
              function compDown(event:Event)
                   down = true;
                   if (up && down)
                        btn = new MyButton(Bitmap(button_up.content), Bitmap(button_down.content));
                        addChild(btn);
                        btn.addEventListener(MouseEvent.CLICK, my);
              function my(event:MouseEvent)
                   btn.pressed();
    And the last main frame of MyButton timeline has: unpressed();
    It all works as I want, but I know, that it's a bad solution... especially calling unpressed() from the frame... So maybe someone could give me some advice about writing my own button class?
    PS and I'm sorry for my Endlish =)

    OK, I got it, thanks )
    But for now I'm afraid I have no time to learn it... but I really got it, I think )
    That's what I get for now:
    package  {
         import flash.display.MovieClip;
        import flash.display.Loader;
        import flash.display.Bitmap;
        import flash.net.URLRequest;
        import flash.display.LoaderInfo;    
        import flash.events.MouseEvent;
        import flash.events.Event;
        public class MyButton extends MovieClip
             public var upStatePath:String;
            public var downStatePath:String;
         public var l:Loader = new Loader();
         var b:Boolean;
            public function MyButton(_upState:String, _downState:String)
              upStatePath = _upState;
              downStatePath = _downState;
              unpressed();
              addEventListener(MouseEvent.CLICK, pressed);
              addFrameScript(totalFrames-1, unpressed)
            public function pressed(event:MouseEvent = null)
              b = true;
              l.contentLoaderInfo.addEventListener(Event.COMPLETE, showPic);
                 l.load(new URLRequest(downStatePath));
            public function unpressed()
              b = false;
              l.contentLoaderInfo.addEventListener(Event.COMPLETE, showPic);
                    l.load(new URLRequest(upStatePath));
                    gotoAndStop(1);
         function showPic(event:Event)
              try {
                   removeChildAt(0);
              catch(e:Error) {}
              addChild(Bitmap(l.content));
              if (b) play();
    It works as I want, no code in the frames, quite independent I guess ))
    That's enough for me for now )
    Thanks for help!

  • Font color issue with inserted HTML content in JTextPane (HTMLEditor)

    Hi everyone,
    I have a very serious issue with the HTMLEditor I'm developping. This editor is a little bit special since it is intended to edit blocks of HTML content that are loaded when the editor is initialized.
    You can in fact decide to keep this loaded HTML content or start a new HTML document from scratch. Alright, now my issue is the following :
    When text is loaded, it's properly rendered. I have a functionality which let's you see the HTML code from the HTML document used in the editor, so I can check and see if code is correct, and yes, it's correct.
    The problem is that when I try to change the color attribute of some text on my loaded content, nothing happens ! I don't know what's the matter with this bug, I only have it with the color attribute, with every other attribute everything's fine (font, size, etc.)
    The funny thing is that, after I change another attribute for loaded content, like font family, then changing color attribute funcionnality starts to work again !
    I've also noticed that I don't have any of these problems when I start my HTMLDocument from scratch (when I create a new HTML document and start typing text).
    Another weird thing, is that I have a feed-back feature in my editor which reflects attributes for text over which the caret is positionned. For example, if you put caret over red text, the color combo box displays a red value, you know, just like in MS Word. Well, with my loaded content if I have a red text color and I decide to put it in green, the color combo box displays the green value when I click over text for which I have changed color, but in my JTextPane it's still red !! And when I try to see the HTML code generated nothing has changed, everything is still red !
    There is something really strange here, this means that when I get the attributes of the loaded text from the HTMLDocument, color appears to be green, but when it gets rendered in the JTextPane it's still red and when it gets anlyzed to produce the corresponding HTML code, these changed attributes are not taken into account.
    But the most weird thing above all, is that I don't have this bug everytime, sometimes I start my HTML editor applet and it works fine, and some other times this color issue is bakc there. Is this a known bug for Swing API or not ?
    =============
    This is more or less my technique :
    //I declare a global reference to my HTMLDocument
    HTMLDocument _docHTMLDoc;
    //Create a JTextPane
    JTextPane _tpaEditor = new JTextPane( );
    //Set type content to automatically select HTMLEditorKit
    _tpaEditor.setContentType("text/html");
    //Get a referene to its HTMLEditorKit
    HTMLEditorKit _kitHTMLEditor = (HTMLEditorKit) _tpaEditor.getEditorKit( );
    //I then have a function to create new documents
    void newDocument(){
      _docHTMLDoc = (HTMLDocument) _kitHTMLEditor.createDefaultDocument();
      _tpaEditor.setDocument(_docHTMLDoc);
       //I do other stuff wich are not important to be shown here
    //I then have another function to load content
    void loadContent(){
       //I get content from a HashMap I initialized when I started my applet
       String strContent = (String)_mapInitParameters.get("html_content");
       //I set content for my editor
       _tpaEditor.setText(strContent);
    //Notice.. I have tried many other ways to load this text : via HTMLEditorKit and its insertHTML method, I
    //have also tried to store this content in some reader and make HTMLEditorKit read it... and nothing,
    // I always get the bug
    //To change color it goes like this :
    JComboBox _cboColor = new JComboBox();
    //I correctly initialize this combo with colors
    //then I do something like this
    ActionListener _lst = new ActionListener(){
       public void actionPeformed(ActionEvent e){
          Color colSel = (Color) _cboColor.getSelectedItem();
          MutableAttributeSet mas = new SimpleAttributeSet();
          StyleConstants.setForeground(mas,colSel);
          setAttributeSet(mas);
    _cboColor.addActionListener(_lst);
    //Set Attributes goes something like this
    private void setAttributeSet(javax.swing.text.AttributeSet atrAttributeSet) {       
            //Get current 'End' and 'Start' positions
            int intCurrPosStart = _tpaEditor.getSelectionStart();
            int intCurrPosEnd = _tpaEditor.getSelectionEnd();
            if(intCurrPosStart != intCurrPosEnd){
                //Apply attributes to selection
                _docHTMLDoc.setCharacterAttributes(intCurrPosStart,intCurrPosEnd - intCurrPosStart,atrAttributeSet,false);
            else{
                //No selection : apply attributes to further typed text
                MutableAttributeSet atrInputAttributes = _kitHTMLEditor.getInputAttributes();
                atrInputAttributes.addAttributes(atrAttributeSet);

    hi, friend!
    try this:
    void setAttributeToText(JTextPane pane, int start, int end, Color color) {
    MutableAttributeSet new_att = new SimpleAttributeSet();
    StyleConstants.setForeground(new_att,color);
    HTMLDocument doc=(HTMLDocument)pane.getDocument();
    doc.setCharacterAttributes(start,end,new_att,false);
    It works fine in my Application, hope will work in yours, too.
    good luck.

  • App update with application loader: bundle is invalid - CFBundleShortVersionString error

    Hi,
    A client of mine is trying to update their app. They created a new multi-issue viewer (using ver18).
    When uploading this app with application loader they receive the following error:
    "This bundle is invalid. The key CFBundleShortVersionString in the info.plist file must contain a higher version than that of the previously uploaded version".
    (see screenshot)
    When checking, the update app indeed had a lower version (iTunes) number than the one already on the app store. So I figured that was the issue, but when selecting a higher version and trying again the error still persists.
    I couldn't really find anyone on the forum who previously had this issue.
    Tips are always welcome
    Thanks

    Hi
    I have the same problem, we built the first app for our client through WoodWing, now we want to update the app with the Adobe one. During the upload of the new app, created with the Adobe Viewer Builder we get this error code:
    This bundle is invalid. The key CFBundleShortVersionString in the Info.plist file must contain a higher version than that of the previously uploaded version.
    When we open the Info.plist we can see that the Adobe Viewer Builder creates 1.0.1 for the Bundle Version String short, while the older WoodWing app has 2.1.
    Marketing version in Viewer Builder = Bundle Version String Short or ?
    That means everybody who is changing from the WoodWing to the Adobe reader needs to go through Adobe?

  • I have 12 core with Quatro 4000 and 5770, I want to use dual monitor setup, monitors are NEC with Spectraview-II.  How do I connect?  4000 only has 1 Display Port and 1 DVI.  5770 has 2 of each, if I use both 5770 Display Ports, does the 4000 contribute?

    I just bought a 12 core with Quatro 4000 and 5770, I want to use dual monitor setup, monitors are NEC with Spectraview-II.  How do I connect?  4000 only has 1 Display Port and 1 DVI.  5770 has 2 of each, if I use both 5770 Display Ports, does the 4000 contribute any work at all?  I read where on a PC they would work together, but on a MAC they do not.
    I read that Display Port has higher band width than DVI, NEC monitors for best performance they recommend using DIsplay Port.
    When I was setting this up I looked at a Nvidia Quadro 4000, unfortunately it was for PC, it had 2 Display Ports, in the Mac version they reduce it to one.  I did not think there could be a difference.
    Mainly want to use it for CS6 and LR4.
    How to proceed??? 
    I do not want to use the Quadro 4000 for both, that would not optimize both monitors, one DP and 1 DVI.  Using just the 5770 would work but I do not think the 4000 would be doing anything, and the 5770 has been replaced by the 5870.more bandwidth.
    Any ideas, I am a Mac newbie, have not ever tried a Mac Pro, just bought off ebay and now I have these problems.
    As a last resort I could sell both and get a 5870.  That would work, I'm sure of that, it's just that I wanted the better graphics card.
    Thanks,
    Bill

    The Hatter,
    I am a novice at Mac so I read all I can.  From what I understand the NEC monitors I bought require Display Port for their maximum performance.  The GTX 680 only has DVI outputs.  Difference from what I understand is larger bandwidth with the DP.
    You said I have the 4000 for CUDA.  I am not all that familiar with CUDA and when I do read about it I do not understand it. 
    A concern I have is, that if I connect the 2 high end NEC monitors via the 5770, using it's 2 Display Ports I would have nothing connected to the 4000.  Is the 4000 doing anything with nothing connected?  I read where in a PC system the 2 cards would interact but in a Mac system they do not.
    Bottom line, as I see it, the 4000 will not be useful at all to me, since I want a dual monitor set-up.
    So far the 5870 seems the best choice, higher band width than the 5770, and it has 2 Display Ports to optimize the NEC monitors.
    I'm not sure how fine I am splitting hairs, nor do I know how important those hairs are.  I am just trying to set up a really fast reliable system that will mainly be used for CS6 and LR4.  Those NEC monitors are supposed to be top notch.

  • I use an Epson Stylus Office BX320FW printer with my IMac.  Since upgrading OSX, I have lost the ability to print and scan.  I have downloaded printer drivers from both Epson and Apple.  I am using the printer in wifi mode but can not get it print or scan

    Hi Everybody,
    I use an Epson Stylus Office BX320FW printer with my IMac.  Since upgrading OSX, I have lost the ability to print and scan.  I have downloaded printer drivers from both Epson and Apple.  I am using the printer in wifi mode but can not get it print or scan.  How do I uninstall the Epson software and start all over again?
    nickel_man_65

    Not using any mouse pad, I have a very smooth desktop. But I just tried to use a sheet of A4 printing paper, but no result, the problem persisted.
    Someone on this forum suggested, that USB3 may interfere with the magic mouse.
    I have 2 LaCie HDD's about 70 cm away from the mouse, I use them on Thunderbolt. But in operation or not - the result is the same, the mouse plays up! Just now I was clicking the desktop and the mouse created a new folder!!
    Thanks for the advice, Bee
    Cheers, Gerd

  • TS2972 I would like to share my iTunes libraries with my Apple TV from both my iMac and Macbook Pro, but I use the same iTunes account on both devices. Is it possible to link my Apple TV to both devices at the same time?

    I recently purchased an Apple TV, and I currently have it linked to my iMac with my iTunes account. I also have a newer MacBook Pro that has some different iTunes media on it than my iMac does, but they share iTunes accounts. Is it possible to link both devices at the same time, have access to media on both computers, and use the same iTunes account on both computers?? It seems Apple TV will only link to one iTunes account per computer, but can access multiple computers if different iTunes accounts are activated on those computers.

    You can share multiple libraries with the Apple TV, they don't even need to use the same iTunes account. Just make sure that you use the same ID for homesharing on all devices.

Maybe you are looking for