views:

13

answers:

0

For some reason

same function called from another class acts differently, if function called from ini() then it adds the button to the display and we can see it.

If we call the same function externally then it adds the button just that we cant see it....what do I need to do to fix this ??

<fx:Script>
    <![CDATA[
        import mx.core.FlexGlobals;
        import com.bacardi.model.vo.FlashVarsVo;
        //language specific
        [Bindable] private var lang_close:String;
        //
        [Bindable] private var pathtoimages             :String;

        private function init():void
        {
            pathtoimages=FlexGlobals.topLevelApplication.parameters.pathtoimages;
            trace("quiz content init")//called before refreshPageContent
            //refreshPageContent(0);//called from here it works !!!!
        }

        public function refreshPageContent(dta:Object):void
        {
        trace("refreshPageContent")//caled after init
        lang_close=FlashVarsVo.getVar("close_en");
        var bttn:Button=new Button();
        tg.addElement(bttn);
        //
        }


        public function refreshPage(which:uint):void
        {
        trace("refreshPage:",tg);//called after init
        tg.autoLayout=true;
        var bttn:Button=new Button();
        addElement(bttn);

        }

    ]]>
</fx:Script>


    <s:Button label="{lang_close}" styleName="closeBttn" skinClass="skins.CloseBttnSkin"/>
    <s:Scroller>
        <s:TileGroup id="tg"  height="200" width="400" verticalGap="5" horizontalGap="4" horizontalCenter="0" />
    </s:Scroller>

</s:SkinnableContainer>