Showing posts with label ActionScript 3. Show all posts
Showing posts with label ActionScript 3. Show all posts

Tuesday, May 19, 2009

Required skin part area cannot be found.

No comments :

Problem:

Error: Required skin part area cannot be found.
at spark.components.supportClasses::SkinnableComponent/findSkinParts()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:549]
at spark.components.supportClasses::SkinnableComponent/loadSkin()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:524]
at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:280]
at spark.components.supportClasses::SkinnableComponent/createChildren()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:250]
at com.riageeks.geek::GeekBase/createChildren()[C:\geek\GeekBase.as:130]
at mx.core::UIComponent/initialize()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6402]
at mx.core::UIComponent/addChildAt()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6109]
at spark.components::Group/addItemToDisplayList()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:1588]
at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:1153]
at spark.components::Group/setMXMLContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:409]
at spark.components::Group/set mxmlContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:359]
at spark.components::SkinnableContainer/set mxmlContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:563]
at spark.components::SkinnableContainer/createDeferredContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:1084]
at spark.components::SkinnableContainer/createContentIfNeeded()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:1098]
at spark.components::SkinnableContainer/createChildren()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:843]
at mx.core::UIComponent/initialize()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at spark.components::Application/initialize()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Application.as:708]
at thingsapp/initialize()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:2263]
at mx.managers::SystemManager/initializeTopLevelWindow()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3610]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3395]
at mx.managers::SystemManager/docFrameListener()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3253]

Solution: In my case, I forgot to define a SkinPart for a component, you manually have to go through each Skin file and then verify which skin you missed in your component.

Read More

Thursday, May 14, 2009

ArgumentError: Undefined state 'up'.

No comments :

Problem:

ArgumentError: Undefined state 'up'.
at mx.core::UIComponent/getState()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:9030]
at mx.core::UIComponent/findCommonBaseState()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:9050]
at mx.core::UIComponent/commitCurrentState()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:8881]
at mx.core::UIComponent/creationCompleteHandler()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:10429]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:11262]
at mx.core::UIComponent/set initialized()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:1513]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\flexsource\frameworks\projects\framework\src\mx\managers\LayoutManager.as:757]

Solution: You have defined a skin for a component and that skin expects some states to be defined for the component. e.g. a Button expects 4 states to be defined in Skin. Below is a basic skin for a Button.

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" >

<s:states>
<s:State name="up"/>
<s:State name="over"/>
<s:State name="down"/>
<s:State name="disabled"/>
</s:states>
<s:Rect height="100%" width="100%">
<s:fill>
<s:SolidColor color="#0000FF"/>
</s:fill>
</s:Rect>

</s:SparkSkin>
Read More

Error: Required skin part area cannot be found.

No comments :

Problem:

Error: Required skin part area cannot be found.
at spark.components.supportClasses::SkinnableComponent/findSkinParts()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:549]
at spark.components.supportClasses::SkinnableComponent/loadSkin()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:524]
at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:280]
at spark.components.supportClasses::SkinnableComponent/createChildren()[C:\flexsource\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:250]
at com.riageeks.geek.core::GeekBase/createChildren()[C:\riageeks\geek\trunk\geek\src\com\rg\geek\core\GeekBase.as:71]
at mx.core::UIComponent/initialize()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6402]
at mx.core::UIComponent/addChildAt()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6109]
at spark.components::Group/addItemToDisplayList()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:1588]
at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:1153]
at spark.components::Group/setMXMLContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:409]
at spark.components::Group/set mxmlContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Group.as:359]
at spark.components::SkinnableContainer/set mxmlContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:563]
at spark.components::SkinnableContainer/createDeferredContent()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:1084]
at spark.components::SkinnableContainer/createContentIfNeeded()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:1098]
at spark.components::SkinnableContainer/createChildren()[C:\flexsource\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:843]
at mx.core::UIComponent/initialize()[C:\flexsource\frameworks\projects\framework\src\mx\core\UIComponent.as:6510]
at spark.components::Application/initialize()[C:\flexsource\frameworks\projects\flex4\src\spark\components\Application.as:708]
at thingsapp/initialize()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:2263]
at mx.managers::SystemManager/initializeTopLevelWindow()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3610]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3395]
at mx.managers::SystemManager/docFrameListener()[C:\flexsource\frameworks\projects\framework\src\mx\managers\SystemManager.as:3253]


Solution: In Gumbo, you define your skin part with either required=true or required=false. And then that skin need to be defined in your Skin file, which starts with "SparkSkin". If you have defined required=true then it should be defined out of the <Declarations> tag, if you have defined required=false, then it should be defined in <Declarations> tag. In both the cases, variable name and skin id should match (i.e. variable name defined in your source file and id given in Skin file)

Read More

Tuesday, May 12, 2009

Skin for * cannot be found

No comments :

Problem:

Error: Skin for riageekapp0 cannot be found.
at spark.components.supportClasses::SkinnableComponent/loadSkin()[E:\dev\i11.5\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:460]
at spark.components.supportClasses::SkinnableComponent/validateSkinChange()[E:\dev\i11.5\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:240]
at spark.components.supportClasses::SkinnableComponent/createChildren()[E:\dev\i11.5\frameworks\projects\flex4\src\spark\components\supportClasses\SkinnableComponent.as:210]
at spark.components::SkinnableContainer/createChildren()[E:\dev\i11.5\frameworks\projects\flex4\src\spark\components\SkinnableContainer.as:797]
at mx.core::UIComponent/initialize()[E:\dev\i11.5\frameworks\projects\framework\src\mx\core\UIComponent.as:6632]
at spark.components::Application/initialize()[E:\dev\i11.5\frameworks\projects\flex4\src\spark\components\Application.as:678]
at thingsapp/initialize()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:2214]
at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:3558]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:3343]
at mx.managers::SystemManager/docFrameListener()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:3201]


 



Solution: I was using different build of Gumbo, so the library(swc) created in one version was not able to found some classes. To fix this error, make sure that you are using same version of build for both your library(swc) and the application project.

Read More

Error #1053

No comments :

Error #1053:

VerifyError: Error #1053: Illegal override of skinParts in com.riageeks.comps.TestComponent.

at flash.display::MovieClip/nextFrame()
at mx.managers::SystemManager/deferredNextFrame()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:349]
at mx.managers::SystemManager/preloader_initProgressHandler()[E:\dev\i11.5\frameworks\projects\framework\src\mx\managers\SystemManager.as:3230]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\i11.5\frameworks\projects\framework\src\mx\preloaders\Preloader.as:418]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()


Solution: I was using different build of Gumbo, so the library(swc) created in one version was not able to found some classes. To fix this error, make sure that you are using same version of build for both your library(swc) and the application project.

Read More

Wednesday, February 18, 2009

Flex Component Life Cycle - in my way

No comments :
I have developed a few set of flex components and my friend Jorge wanted to know exactly what is happening inside it. This blog was also waiting for something for a long time. So, here it goes in my cooking way :D.
Chetan,
Can you try a last time explanation of what each step of the event flow is supposed to do?
createChildren - 
create all child components, don't give them any sizing information, just create, these are like ingredients for your component dish, you are gonna mix them up and bake them and serve it to eat :)
commitProperties
Each ingredient has some property, sweet/sour etc. you set how much is needed and for what. say button, user wants a long label (more sweet), assign them in commitProperties, use invalidation/validation model. 
measure
You want to serve better right !, say you are making a drink, then it will have a specific quantity according to you the cook. You finalize that 300 ml is sufficient, if user wants more then S/he will take it or something. but 300 ml is what you decide. So each component need to have some specific size, if user supplies width/height then measure will not be called otherwise it will be called. :D
updateDisplayList
Now, updateDisplayList gets height/width from measure or from the user supplied. You don't want same quantity of salt in 100 ml, which you will give in 300 ml. So based on the height/width you get in updateDisplayList, draw them accordingly, more specifically cook it :D
Hope its clear and fun reading flex in this way.
--
Chetan
www.riageeks.com
Read More

Thursday, October 16, 2008

BindingUtils Example

4 comments :
I am working on an application which is not architect properly. So, I need to find solutions which just keeps things going. I have an illustration below for your reference:
image
Say, I have 3 custom components on my screen namely:
  • Component 1
  • Component 2
  • Component 3
Requirement is:
For Component 1:
Whenever some specific property changes in Component 1, it should be reflected in Component 3.
Whenever some properties in Component 2 changes, Component 1 should reflect those values.

For Component 2:
Nothing, It could just work independently

For Component 3:
It can work independently but it has to display updates from Component 1 and Component 2.
Problem:
As I mentioned there is no Framework used and application is not architect so I used Binding for rescue. (You can do it by passing values in a CustomEvent and passing those values from one component to other component, I guess BindingUtils do the same.)

Below is a sample code:
BindingUtilsExample.mxml
<?xml version="1.0" encoding="utf-8"?>


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCC()">


<mx:Script>


<![CDATA[


import mx.binding.utils.BindingUtils;


import mx.controls.Alert;
[Bindable]
public var ds:DataSingleton = DataSingleton.getInstance();

/**
  * called on creation complete to bind my textinput to my data
  */
public function onCC():void{
BindingUtils.bindProperty(myTxtInput,"text", ds,"data");
}

/**
  * Every time I click on button, I update values in my model (Simply a +1 that too string
  */
public function onClick():void{
if(ds.data != null )
{
ds.data += " 1";
}else{
ds.data = "some value";
} 

//Alert.show(ds.data);
}
]]>
</mx:Script>
<mx:VBox height="100%" width="100%">
<mx:HBox width="100%" height="100%">
<mx:Panel title="Component 1" height="100%" width="100%">
<mx:TextInput id="myTxtInput" text="This will have binding from my model"  width="100%"/>
</mx:Panel>
</mx:HBox>
<mx:HBox width="100%" height="100%">
<mx:Panel title="Component 2" height="100%" width="100%">
<mx:Label text="Click on button to update model value"/>
<mx:Button label="Click me" click="onClick()" />
</mx:Panel>
</mx:HBox>
</mx:VBox>
</mx:Application>
DataSingleton.as
package {
public class DataSingleton {
/**
  * Single instance which will exist throughout the app
  * for this class
  */
private static var instance:DataSingleton;
/**
  * Flag to check wheather instance already exist or not
  */
private static var allowInstantiation:Boolean;
/**
  * Data which I want to share across components
  */
private var _data:String;
/**
  * Method to get the instance of this class
  */
public static function getInstance():DataSingleton {
if (instance == null) {
allowInstantiation = true;
instance = new DataSingleton();
allowInstantiation = false;
}
return instance;
}
/**
  * Constructor
  * Checks if instance already exists then throw an error
  */
public function DataSingleton():void {
if (!allowInstantiation) {
throw new Error("Error: Its a Singleton Class. Use DataSingleton.getInstance() to instantiate.");
}
}
[Bindable]
/**
  * Make getter method of your data [Bindable] to make BindingUtils to get these values
  */
public function get data():String{
return this._data;
}
/**
  * Setter for my data to share across
  * Call this method in one of your component to update it and let BindingUtils update it for you 
  * in some other component
  */
public function set data(value:String):void{
this._data = value;
}
}
}

Here is what I have done:
  1. Create a Singleton Class
  2. Defining the properties you want to bind and share across different Components
  3. Make the getter of that property [Bindable]
    e.g.:


    [Bindable]
    //Make getter method of your data [Bindable] to make BindingUtils to
    //get these value
      public function get data():String{
          return this._data;
      }

  4. On creationComplete event (this is specific to my case, may be you need to find when it is suitable for you to bind, as when all components get ready)

    BindingUtils.bindProperty(myTxtInput,"text", ds,"data");

    I have one text input in my example which needs to be updated on click of a Button in some other component. Click of button, basically updates property of my singleton class. Here is a description for arguments provided in bindProperty method:






    1. myTxtInput: Object which you want to update
    2. text: Object's property which will get the value (In my case its a textinput text property)
    3. ds: Object from where you which you will get the value
    4. data: property which needs to be assigned. (Right side argument)


One more finding (Setting dataProvider in actionscript 3):

In MXML, I used to write something like

public var myArrayCollection:ArrayCollection = new ArrayCollection();

<mx:SomeComponent id="myComponent" dataProvider={myArrayCollection} ..... />

To set dataProvider in actionscript and binding it, equivalent to above is:

BindingUtils.bindProperty(myComponent,"dataProvider", this,"myArrayCollection");

To see sample example Click here.
Read More

Tuesday, June 03, 2008

Error 1084

No comments :

1084: Syntax error: expecting colon before leftbrace.   

1084: Syntax error: expecting identifier before rightbrace.   

1084: Syntax error: expecting rightbrace before semicolon.   

1084: Syntax error: expecting rightparen before rightbrace.   

1084: Syntax error: expecting semicolon before rightparen.   

 

Possible Reasons:

  1. Some typo mistake could lead to this error.
    e.g.
    • for(var z:int = 0; z<items, z++)
      instead of semicolon, you put comma
    • if(a==0{
      missed right parentheses before left brace

 

Do you know any other possible reason for this ?

Read More

Error 1180

No comments :

 

1180: Call to a possibly undefined method doPrint.   

Here doPrint is my Method Name.

Possible Reason:

  1. Trying to invoke the method which is not available. Define that method and problem gets fixed.

 

 

Do you know any other possible reason for this ?

Read More

Error 1061

No comments :

A Basic Error:

1061: Call to a possibly undefined method through a reference with static type Class.

Severity and Description    Path    Resource    Location    Creation Time    Id
1061: Call to a possibly undefined method addObject through a reference with static type FlexPrintJob.    FlexPrintJobExample/src    FlexPrintJob.mxml    line 11    1212473910669    732

Possible Reasons:

  • I named my MXML file as FlexPrintJob, but as its an internal class, so I got this error. Rename the file and error gets fixed.

 

Do you know any other possible reasons ?

Read More