4 Replies Latest reply on Jun 18, 2011 4:57 PM by Shongrunden

    Setting skinclass style property of ViewNavigator causes runtime error

    malenam

      Hi,

      I am building a mobile app with Flash Builder 4.5. the project is of type ViewNavigatorApplication. What I want to do is to add an image as a background to all the Views. In a previous email I was told to add the image as a child to a customized  ViewNavigatorSkin in the createChilder() method.

      So since the ViewNavigator is instantiated inthe ViewNavigatorApplicationSkin, i created two customized skins one for the ViewNavigatorApplication and one for the ViewNavigator.  In the new customized skin (I called it Whateverskin)  that I subclassed from ViewNavigatorApplication skin I added the following line to set the the style skinclass property of the navigator instance like this:

       

      navigator = new ViewNavigator();

      navigator.id = "navigator";
      navigator.setStyle("skinClass","MySkins.MyViewNavigatorSkin"); // setting my own customized skin for the ViewNavigator

       


      But the application breaks as soon as the "skinClass" property style is set. I get the following debugger errors.I don't understand the first error message, complaining that "Whateverskin2.navigator" cannot be found, because the number "2" appended to the end of the name of the skin class "Whateverskin" is being done by Flex. My skin class is named "Whateverskin.as" no "Whateverskin2.as". So I don't know what is going on.

       

      Any idea?

       

      thanks

       

      ---------------------------------------------------

       

      Error: Skin for TastingNotes0.WhateverSkin2.navigator cannot be found.

       

          at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\hero_private\fram eworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:698]

       

          at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\hero_priv ate\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:44 3]

       

          at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\hero_private\ frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]

       

          at spark.components::SkinnableContainer/createChildren()[E:\dev\hero_private\frameworks\proj ects\spark\src\spark\components\SkinnableContainer.as:879]

       

          at mx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\m x\core\UIComponent.as:7624]

       

          at spark.components.supportClasses::ViewNavigatorBase/initialize()[E:\dev\hero_private\frame works\projects\mobilecomponents\src\spark\components\supportClasses\ViewNavigatorBase.as:6 42]

       

          at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\hero_private\frameworks\pr ojects\framework\src\mx\core\UIComponent.as:7485]

       

          at mx.core::UIComponent/addChild()[E:\dev\hero_private\frameworks\projects\framework\src\mx\ core\UIComponent.as:7166]

       

          at MySkins::WhateverSkin/createChildren()[C:\Users\mmesarin\Documents\Comparing-Platforms\Fl ex4.5\Code\TastingNotes\src\MySkins\WhateverSkin.as:119]

       

          at mx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\m x\core\UIComponent.as:7624]

       

          at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\hero_private\frameworks\pr ojects\framework\src\mx\core\UIComponent.as:7485]

       

          at mx.core::UIComponent/addChild()[E:\dev\hero_private\frameworks\projects\framework\src\mx\ core\UIComponent.as:7166]

       

          at spark.components.supportClasses::SkinnableComponent/attachSkin()[E:\dev\hero_private\fram eworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:692]

       

          at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\hero_priv ate\frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:44 3]

       

          at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\hero_private\ frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:406]

       

          at spark.components::SkinnableContainer/createChildren()[E:\dev\hero_private\frameworks\proj ects\spark\src\spark\components\SkinnableContainer.as:879]

       

          at spark.components::Application/createChildren()[E:\dev\hero_private\frameworks\projects\sp ark\src\spark\components\Application.as:1274]

       

          at mx.core::UIComponent/initialize()[E:\dev\hero_private\frameworks\projects\framework\src\m x\core\UIComponent.as:7624]

       

          at spark.components::Application/initialize()[E:\dev\hero_private\frameworks\projects\spark\ src\spark\components\Application.as:1259]

       

          at spark.components.supportClasses::ViewNavigatorApplicationBase/initialize()[E:\dev\hero_pr ivate\frameworks\projects\mobilecomponents\src\spark\components\supportClasses\ViewNavigat orApplicationBase.as:762]

       

          at TastingNotes/initialize()

       

          at mx.managers.systemClasses::ChildManager/childAdded()[E:\dev\hero_private\frameworks\proje cts\framework\src\mx\managers\systemClasses\ChildManager.as:189]

       

          at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()[E:\dev\hero_private\fr ameworks\projects\framework\src\mx\managers\systemClasses\ChildManager.as:359]

       

          at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\hero_private\frameworks\proj ects\framework\src\mx\managers\SystemManager.as:3063]

       

          at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\hero_private\frameworks\proje cts\framework\src\mx\managers\SystemManager.as:2849]

       

          at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\hero_privat e\frameworks\projects\framework\src\mx\managers\SystemManager.as:2729]

       

          at flash.events::EventDispatcher/dispatchEventFunction()

       

          at flash.events::EventDispatcher/dispatchEvent()

       

          at mx.preloaders::Preloader/timerHandler()[E:\dev\hero_private\frameworks\projects\framework \src\mx\preloaders\Preloader.as:542]

       

          at flash.utils::Timer/_timerDispatch()

       

          at flash.utils::Timer/tick()