Shared code problem.  Put all shared classes in the main app or a shared
code module.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of lytvynyuk
Sent: Tuesday, October 30, 2007 3:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Type coercion error for ToggleButtonBar in very
simple example.... possibly bug!

 

Here is example

Application:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
        ]]>
    </mx:Script>
    <mx:Button x="133" y="10" label="s1" id="button1"
click="{mod1.url='modules/m1.swf';mod1.loadModule();}"/>
    <mx:Button x="181" y="10" label="s2" id="button2"
click="{mod1.url='modules/m2.swf';mod1.loadModule();}"/>
    <mx:Canvas id="c1">
        <mx:ModuleLoader id="mod1" width="100%" height="100%" x="0! "
y="100" loading="Alert.show('LOADING')" ready="Alert.show('READY')"/>

    </mx:Canvas>
</mx:Application>

Module1:

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
width="400" height="300" backgroundColor="green">
    <mx:VBox width="100%" height="100%">
        <mx:ViewStack x="0" y="0" id="viewstack1" width="100%"
height="100%">
            <mx:Canvas label="View 1" width="100%" height="100%">
                <mx:Label text="View 1"/>
            </mx:Can! vas>
          &! nbsp; &l t;mx:Canvas label="View 2" width="100%"
height="100%">
                <mx:Label text="View 2"/>
            </mx:Canvas>
        </mx:ViewStack>
        <mx:ToggleButtonBar dataProvider="viewstack1">
        </mx:ToggleButtonBar>
    </mx:VBox>    
</mx:Module>


Module2:


<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
width="400" height="300" backgroundColor="red">
    <mx:VBox width="100%" height="100%">
        <mx:ViewStack! x="0" y="0" id="viewstack1" width="100%"
height="100%">
            <mx:Canvas label="View 1" width="100%" height="100%">
                <mx:Label text="View 1"/>
            </mx:Canvas>
            <mx:Canvas label="View 2" width="100%" height="100%">
                <mx:Label text="View 2"/>
            </mx:Canvas>
        </mx:ViewStack>
        <mx:ToggleButtonBar dataProvider="viewstack1">
        </mx:ToggleButtonBar>
    </mx:VBox>    
&! lt;/mx:Module>

Wh el click button S1 - module loaded OK,
When Click button S2 - gives error:
TypeError: Error #1034: Type Coercion failed: cannot convert
mx.controls::[EMAIL PROTECTED] to mx.controls.ButtonBar.
    at
mx.skins.halo::ButtonBarButtonSkin/mx.skins.halo:ButtonBarButtonSkin::up
dateDisplayList()
    at mx.skins::ProgrammaticSkin/validateDisplayList()
    at mx.managers::LayoutManager/::validateDisplayList()
    at mx.managers::LayoutManager/::doPhasedInstantiation()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/::callLaterDispatcher2()
    at mx.core::UIComponent/::callLaterDispatcher()
    at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
    at flash.utils::Timer/flash.utils:Timer::tick()

in Debug mode even more fancy thing going on, when click at S1 gives
right away error:

VerifyError: Error #1014: Class mx.collections::IList could not be
found.
    at global$init()
    at ()[E:\!!Project\Flex\PicasaFlex\modules\m2.mxml:0]
    at Function/http://adobe.com/AS3/2006/builtin::call()
    at mx.core::ComponentDescriptor/get
properties()[E:\dev\flex\sdk\frameworks\projects\framework\src\mx\core\C
omponentDescriptor.as:239]
    at
mx.core::Container/createComponentFromDescriptor()[E:\dev\flex_3_beta2\s
dk\frameworks\projects\framew! ork\src\mx\core\Container.as:3586]
 &nb! sp;  ; at
mx.core::Container/createComponentsFromDescriptors()[E:\dev\flex_3_beta2
\sdk\frameworks\projects\framework\src\mx\core\Container.as:3522]
    at
mx.core::Container/mx.core:Container::createChildren()[E:\dev\flex_3_bet
a2\sdk\frameworks\projects\framework\src\mx\core\Container.as:2624]
    at
mx.core::UIComponent/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\pro
jects\framework\src\mx\core\UIComponent.as:5144]
    at
mx.core::Container/initialize()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2561]
    at
modules::m2/initialize()[E:\!!Project\Flex\PicasaFlex\modules\m2.mxml:0]
    at mx.core::UIComponent/http://www.adobe.co!
m/2006/flex/mx/internal::childAdded()[E:\dev\flex_3_beta2\sdk\frameworks
\projects\framework\src\mx\core\UIComponent.as:5041]
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdde
d()[E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\Co
ntainer.as:3334]
    at
mx.core::Container/addChildAt()[E:\dev\flex_3_beta2\sdk\frameworks\proje
cts\framework\src\mx\core\Container.as:2258]
    at
mx.core::Container/addChild()[E:\dev\flex_3_beta2\sdk\frameworks\project
s\framework\src\mx\core\Container.as:2188]
    at
mx.modules::ModuleLoader/mx.modules:ModuleLoader::moduleReadyHandler()[E
:\dev\flex_3_beta2\sdk\frameworks\projects\!
framework\src\mx\modules\ModuleLoader.as:339]     at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
ModuleManager.as$25::ModuleInfoProxy/ModuleManager.as$25:ModuleInfoProxy
::moduleEventHandler()[E:\dev\flex_3_beta2\sdk\frameworks\projects\frame
work\src\mx\modules\ModuleManager.as:1025]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
ModuleManager.as$25::ModuleInfo/readyHandler()[E:\dev\flex_3_beta2\sdk\f
rameworks\projects\framework\src\mx\modules\ModuleManager.as:704]
    at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at
mx.core::FlexModuleFactory/mx.core:FlexModuleFactory::update()[E:\dev\fl
ex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\FlexModuleFacto
ry.as:321]
    at
mx.core::FlexModuleFactory/mx.core:FlexModuleFactory::docFrameHandler()[
E:\dev\flex_3_beta2\sdk\frameworks\projects\framework\src\mx\core\FlexMo
duleFactory.as:406]


Any ideas what is going on? may be I do something wrong?

 

Reply via email to