Professional Web Applications Themes

mouseover state flickers - Macromedia Flex General Discussion

Hi, I am using a custom item renderer to show a set of collector cards (normal state shows front, rollover shows back) The parent component is a Tilelist containing a set of VBoxes On the rollover state, the image continuously flickers. How do I keep it from flickering? Here is the code... <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="145" height="188" horizontalAlign="center" verticalGap="0" horizontalScrollPolicy="off" verticalScrollPolicy="off" mouseOver="currentState='rollState'" mouseOut="currentState=''"> <mx:states> <mx:State name="rollState"> <mx:SetProperty target="{photo}" name="source" value="{data.altsource}"/> </mx:State> </mx:states> <mx:Image id="photo" width="120" height="168" source="{data.source}" /> <mx:Label text="{data.character}" fontWeight="bold" fontSize="14" color="yellow" width="136"/> <mx:Label text="{data.name}" fontStyle="italic" /> </mx:VBox>...

  1. #1

    Default mouseover state flickers

    Hi,
    I am using a custom item renderer to show a set of collector cards (normal
    state shows front, rollover shows back)
    The parent component is a Tilelist containing a set of VBoxes
    On the rollover state, the image continuously flickers. How do I keep it from
    flickering?

    Here is the code...

    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
    width="145" height="188"
    horizontalAlign="center" verticalGap="0"
    horizontalScrollPolicy="off" verticalScrollPolicy="off"
    mouseOver="currentState='rollState'" mouseOut="currentState=''">
    <mx:states>
    <mx:State name="rollState">
    <mx:SetProperty target="{photo}" name="source" value="{data.altsource}"/>
    </mx:State>
    </mx:states>
    <mx:Image id="photo"
    width="120" height="168"
    source="{data.source}" />
    <mx:Label text="{data.character}" fontWeight="bold" fontSize="14"
    color="yellow" width="136"/>
    <mx:Label text="{data.name}" fontStyle="italic" />
    </mx:VBox>

    cmcskevin Guest

  2. #2

    Default Re: mouseover state flickers

    Your problem stems from multiple mouseOver events. I've made some
    modifications to your code which seem to work. The states have been removed
    and replaced with actionScript methods which do the following:

    The method for the mouseOver event swaps the image and disables the event to
    prevent flicker. The method for the mouseOut event will restore both the image
    and the mouseOver event.

    The other change is the source of the event. Rather than the box, the photo
    should be the source of the event just in case the photo is not the same
    dimension as the box.

    <mx:Script>
    <![CDATA[
    [Bindable]
    [Embed(source="Rick.jpg")]
    private var p1: Class;

    [Bindable]
    [Embed(source="duck.jpg")]
    private var p2: Class;

    private var toggle : Boolean = false;

    private function rollDuck(event : MouseEvent) : void
    {
    // this event is triggered the first time the mouseOver happens.
    photo.source = p2;
    // now remove event barrage to stop flickr
    photo.removeEventListener(MouseEvent.MOUSE_OVER, rollDuck);
    }

    private function rollBack(event : MouseEvent) : void
    {
    // replace original photo
    photo.source = p1;
    // restore roll over event
    photo.addEventListener(MouseEvent.MOUSE_OVER, rollDuck);
    }
    ]]>
    </mx:Script>
    <mx:VBox id="boxedIn" xmlns:mx="http://www.adobe.com/2006/mxml"
    width="145" height="188"
    horizontalAlign="center" verticalGap="0"
    horizontalScrollPolicy="off" verticalScrollPolicy="off">
    <mx:Image id="photo"
    width="120" height="168"
    source="{p1}" mouseOver="rollDuck(event)" mouseOut="rollBack(event)"/>
    <mx:Label text="Moose" fontWeight="bold" fontSize="14" color="yellow"
    width="136"/>
    <mx:Label text="Yada" fontStyle="italic" />
    </mx:VBox>



    javamonjoe Guest

  3. #3

    Default Re: mouseover state flickers

    It flicks one time....
    When 1 change...
    why?
    Unregistered Guest

Similar Threads

  1. ie6 is briefly flashing mouseover state on menu dropdown
    By kirkwicks in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: October 1st, 09:02 PM
  2. Cursor flickers whle over flash movie
    By theRealEverett webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: December 17th, 08:41 PM
  3. Video flickers in Director when using Flash with it
    By vector1 webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 6
    Last Post: September 20th, 05:53 PM
  4. Alpha-enabled MIAW flickers on opening
    By theo in forum Macromedia Director Basics
    Replies: 1
    Last Post: September 10th, 02:50 PM
  5. direct to stage flickers and flash
    By EdMX webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: September 9th, 05:35 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