Skip to main content
Participating Frequently
December 3, 2009
Answered

Use of createDynamicPartInstance

  • December 3, 2009
  • 1 reply
  • 1021 views

Hi,

I'm trying to learn the new Flex 4 component architecture by making some simple components.

The first component I'd like to do is made up of a TextInput and a clickable BitmapImage.

When the image is clicked, a list of buttons (number of button specified via a property) appears in a pop-up.

From what I read in the specs, this is a case when I have to use createDynamicPartInstance.

Unfortunately, there is few documentation at the moment about this method and calling this method always return null.

Please find attached source code of this component.

in openDropDown, createDynamicPartInstance always returns null. I've looked at the source code of createDynamicPartInstance. It tries to find an instance of button but there is no existing instance.

How I am supposed to handle this?

Thanks.

Florian

This topic has been closed for replies.
Correct answer

From a glance, the code looks pretty good.  What's in your skin file?  Did you declare the the button skin part, with something like:

<fx:Declarations>
    <fx:Component id="button">
        <s:Button />
    </fx:Component>
</fx:Declarations>

Attach the skin file, and I'll run the code and take a look.

-Ryan

1 reply

Correct answer
December 3, 2009

From a glance, the code looks pretty good.  What's in your skin file?  Did you declare the the button skin part, with something like:

<fx:Declarations>
    <fx:Component id="button">
        <s:Button />
    </fx:Component>
</fx:Declarations>

Attach the skin file, and I'll run the code and take a look.

-Ryan

Participating Frequently
December 3, 2009

Thanks for answering so fast!

I didn't declare the button skin part in my skin file and this is probably why the function returns null everytime.

I will give it a try in a few hours because it's getting late here, and tell you if it works (but I'm almost sure it will )