Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Thread Tools Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
Old 01-29-2010, 12:41 PM   #1
Registered User
Join Date: Jan 2010
Posts: 1
Default popupmenubutton in a list (custom item renderr)

Hi all, I have this major problem that I cant seem to fix in flex 3. This code base was taken from a flex 2 chat application that worked fine. I have a list of users and I'm using a custom item renederer to display a popupmenubutton next to each user, with particular admin options. When the list is re-ordered (for example a user raises their hand etc). The popupmenu buttons default textdisplayed on the menubutton is wrong (it shows invalid options next to users). If i click the dropdown of the popupmenu button, it shows the correct values, so its like the popupmenu button is not being refreshed/displayed properly, after a reorder, or status change of the list.

Now the code for the custom item renderer is awfull, but I'll post it anway, and ifanyone has any ideas I'd love to hear them.

Before the user put their hand up, the Broadcaster option was next to the admin user. After the user put their hand up,the list gets re-ordered and they get put on top of the queu, but alas the button text does not refresh. If i hit the dropdown however, the broadcaster option isnt there , so it shows it is updating correctly to the right menu items, but the default one shown on the button isnt..

Any help would be greatly appreciated..

ActionScript Code:
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off"  verticalScrollPolicy="off" width="100%" resize="onResize(event)">     .. stuff cut out     <mx:Script>         <![CDATA[             import mx.core.Application;             import mx.controls.List;             import mx.utils.StringUtil;             import mx.events.SliderEvent;             import mx.controls.Alert;             import mx.controls.Label;             import mx.collections.ArrayCollection;             import com.objects.UsersVO;             import flash.utils.getTimer;             import com.objects.UsersVideoStream;             import com.objects.VideoBlock;             import mx.events.MenuEvent;             import mx.events.ResizeEvent;             import com.objects.VideoSettingsEvent;             import mx.controls.Menu;                         [Bindable (ChangeEvent='dpChange')]             private var _data:Object;             [Bindable]             private var _imgIcon:String;             [Bindable]             private var _colour:Number;             [Bindable]             private var _video:Video;             [Bindable]             private var _imgRaiseHand:String = "";             [Bindable]             private var _raisedHandTime:String = "";             [Bindable]             private var _delay:Number;             [Bindable (ChangeEvent='dpChange')]             private var _menuoptions:ArrayCollection;             private var _micVolume:int;             private var _speakerVolume:Number;             private var _micRate:int;             [Event(name="videoSettingsEvent", type="com.objects.VideoSettingsEvent")]                                  [Bindable]             public var chatInstance:Chat;                                 override public function get data():Object             {                 return _data;             }                         override public function set data( value:Object ):void             {                 stuff cut out...                     _menuoptions.addItem("Kick");                     dispatchEvent(new Event("dpChange"));                     p2.visible = (this.parentApplication).chat.moderator;                     p2.validateNow();                     this.validateNow();                                     }                                                 super.data = value;             }                                                                               public function onResize(event:ResizeEvent):void             {                 invalidateDisplayList();                 p2.validateNow();                 this.validateNow();                             }              public function sliderHandler(event:SliderEvent)       {        //Was slided. Adjust the volume of the appropriate client.                 (this.parentApplication).chat.nc.call("AdjustClientLevels", null, _data.uid, int(sldMic.value), sldVol.value);                 trace("adjusting the mic value to " + sldMic.value);       }              public function onSetAudio(pRate:int)       {                 (this.parentApplication).chat.nc.call("AdjustSoundQuality", null, _data.uid, pRate);       }              public function onToggleModerator()       {       }              public function btnApplyVideoClick()       {        dispatchEvent(new VideoSettingsEvent(_data.uid,this.cameraWidth.text,cameraHeight.text,cameraRate.text,cameraFPS.text,cameraKeyframe.text,vidWidth.text,vidHeight.text,cameraQuality.text,VideoSettingsEvent.VIDEO_SETTINGS,true,true));       }                ]]>     </mx:Script>        <mx:Image source="{_imgIcon}" click="onToggleModerator()"  height="30" width="30" id="userImage"/>     <mx:Text id="txtName" text = "{_data.username}" color="{_colour}" selectable="false"   fontSize="10" fontWeight="bold"  height="20" maxWidth="300" width="141"/>     <mx:PopUpMenuButton id="p2"            dataProvider="{_menuoptions}"            fontSize="10"            itemClick="itemClickHandler(event)"            visible="{(this.parentApplication).chat.moderator}" />      stuff cut out..
cameronp is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 07:42 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.