PDA

View Full Version : [AS3] Blank first item in ComboBox


pudrocker
04-29-2009, 03:56 PM
I've imported a swf into my actionscript code which contains a combobox (instance name of "cb"). I'm having an issue with not being able to set the "prompt" property from within the code and also with the first item in the combobox always remaining blank.



When I compile my project withing FlashDevelop, the combobox populates all the items properly, but always leaves the first item (item 0) blank. When I try to assign the "prompt" property to a string, it has no effect - the first item always remains blank. When choosing different items in the combobox, the chosen item does not appear in the combobox for the user to see she has chosen it - it just remains blank.



**PLEASE help**



Here is the condensed code:



[Embed(source = "../../../../flash/as3/video_player.swf")]
private var VideoPlayerAssets:Class;

_xVideoAssetsLoader = new EmbeddedAssetSwfLoader(VideoPlayerAssets);
_xVideoAssetsLoader.addEventListener(EmbeddedAsset SwfLoader.EMBEDDED_ASSET_LOADE D, videoAssetsLoaded); _xVideoAssetsLoader.loadAssetSwf();


_xVideoControlsSymbol = _xVideoAssetsLoader.getSymbolInstance("VideoControlsHome");


_xVideoControlsSymbol.embedWindow.content.cb.promp t = "Choose a Size"; //THIS HAS NO EFFECT



_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "400 x 320", width:400, height:320, data:"400x320" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "480 x 384", width:480, height:384, data:"480x384" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "560 x 448", width:560, height:448, data:"560x448" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "640 x 512", width:640, height:512, data:"640x512" } );



_xVideoControlsSymbol.embedWindow.content.cb.addEv entListener(Event.CHANGE, sizeSelected);

camdagr8
05-09-2009, 04:50 AM
Try this:


_xVideoControlsSymbol.embedWindow.content.cb.remov eAll();

_xVideoControlsSymbol.embedWindow.content.cb.selec tedIndex = -1;

_xVideoControlsSymbol.embedWindow.content.cb.promp t = "Choose a Size";


_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "400 x 320", width:400, height:320, data:"400x320" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "480 x 384", width:480, height:384, data:"480x384" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "560 x 448", width:560, height:448, data:"560x448" } );
_xVideoControlsSymbol.embedWindow.content.cb.addIt em( { label: "640 x 512", width:640, height:512, data:"640x512" } );