Fun at work!

Archive for the ‘Adobe Flex’ Category

Link

Repost: Component Life Cycle in Flex

Repost: Component Life Cycle in Flex

These are the series of methods that are called by Flex Framework for all components:
  1. As the component is going to be in a container, the parent property of the component will be referred to the container.
  2. Component’s Constructor:
    • Setup initial properties and do tasks that are not related to display of UI or not.
    • Don’t create child components or position items.
    • Constructor is called when component is created but the other lifecycle methods don’t occur until a component is added to a container.
  3. Gets the Style setting of the component.
  4. preInitialize event on the component
    • UIComponent is in a very basic stage with no children added at this time.
  5. createChildren() method is called.
    • Creates visual children of the component.
    • Flex doesn’t size or position them at this point because it doesn’t know how much screen space it has.
  6. initialize event is dispatched by the component –
    • All the component’s children are initialized.
  7. commitProperties() method
    • Is responsible to coordinate property modifications.
    • This is needed when there are multiple properties that should be set before you take action.
    • This is called when selectedIndex or selectedChild is called
    • Can be called by calling invalidateProperties(). Each time this method is called commitProperties() is scheduled to be called next time there is a screen repaint or refresh.
  8. measure() method is called only if explicit height and width is not set in the code
    • Flex calls this method to determine how much screen size a component requires.
    • This is not called when the height and width are explicitly set in the code as flex knows offhand how much screen size it will take.
    • This method sets these four properties (or you can set it)
      • measuredMinWidth
      • measuredMinHeight
      • measuredWidth
      • measuredHeight
    • LayoutManager also gets started at this point as layour manager starts with the outermost component and to size the outer most component it should know the size of its children.
    • Can be called by calling invalidateSize(). Each time this method is called measure() is scheduled to called next time there is a screen refresh.
  9. updateDisplayList() method is called
    • Is responsible for positioning of children. You can specify your children here
    • It is passed two paramters
      • unscaledWidth
      • unscaledHeight
    • Flex containers choose never to size one of their children smaller than minimum size but you can choose to override it.
    • Can be called by calling invalidateDisplayList(). Each time this method is called updateDisplayList() is scheduled to be called next time there is a screen refresh.
  10. Dispatches creationComplete event.

Updating the Adobe playerglobal.swc

When I was building the red5sip package on FlashBuilder 4.6, I got the following errors:

1046: Type was not found or was not a compile-time constant: MicrophoneEnhancedOptions. PhoneCanvas.mxml  /red5sip/src    line 158    Flex Problem 
1061: Call to a possibly undefined method getEnhancedMicrophone through a reference with static type Class. PhoneCanvas.mxml    /red5sip/src    line 157    Flex Problem 
1119: Access of possibly undefined property codec through a reference with static type flash.media:Microphone.    PhoneCanvas.mxml    /red5sip/src    line 146    Flex Problem 
1120: Access of undefined property MicrophoneEnhancedMode. PhoneCanvas.mxml /red5sip/src    line 159    Flex Problem 1180: Call to a possibly undefined method MicrophoneEnhancedOptions.    PhoneCanvas.mxml    /red5sip/src    line 158    Flex Problem

 

To solve the problem, the latest version of “playerglobal.swc” must be used. Here are the steps to do this:

1. Download the latest version of “playerglobal.swc” from Adobe here. The latest version as of this writing is “playerglobal11_7.swc”.

2. Create a folder using the version number under “[Flex-SDK-Home]\frameworks\libs\player\[version].” Here version should  be “11”.

3. Copy the file to this folder, and change the filename to “playerglobal.swc”.

4. On the Flash Builder, go to “Project” menu, then open up “Properties”. On the left pane, select “Flex Compiler”. On the right side, you can find “Adobe Flash Player options”. Select “Use a specific version” and input the version of latest  “playerglobal.swc”. Click “Apply”, then “OK”.

5. Now clean and build the project. Done.

How to add older Flex SDKs to Flash Builder 4.6?

Steps in adding older Flex SDK to Flash Builder 4.6.

1. Download the Flex SDK from sourceforge.net here.

2. Extract the SDK zip package to the Adobe Flash Builder SDKs folder. Conventionally, it is located in C:\Program Files\Adobe\Adobe Flash Builder 4.6\sdks\ for Windows.

3. On the FB 4.6 IDE, go to “Windows” and open up “Preferences”. On the left pane, expand the “Flash Builder” menu, and select “Installed Flex SDKs”. Now on the right, click “Add” and browse for the SDK folder you copied in step 3. A name for this SDK will be automatically displayed.

4. Now you should have new SDK listed as Installed Flex SDKs. Check the newly added SDK and click Apply.

5. Done.

Tag Cloud