Copy link to clipboard
Copied
Custom component issue
According to customer requirements, we want to get such an effect in the development of custom components:
Drag and drop custom components to the Flex builder work area, it can generate more than the default properties, not just generate "x", "y" attribute.
【Details are as follows】
We design a custom panel "CustomPanel.mxml" in the project development, then drag it into the workspace in the Flex builder development environment.
View the source code found that it can only generate "x", "y" attribute in default. That is:
<ns2:CustomPanel x="105" y="74">
</ns2:CustomPanel>
【Issue】
How can we do that when drag the 'custom component' into Flex builder workspace, we can generate "layout" attribute in addition to "x", "y" attributes?
That is:
<ns2:CustomPanel x="105" y="74" layout="absolute">
</ns2:CustomPanel>
【Note】
The following code will be generated when the "panel component comes with Flex builder environment" is dragged into workspace.
<mx:Panel x="121" y="134" width="250" height="200" layout="absolute">
</mx:Panel>
How it is done?
Copy link to clipboard
Copied
You'll want to create an extension for your custom component. Details here http://www.adobe.com/devnet/flex/flashbuilder_extensibility/DesignViewExtKitReadme.htm.
Jason San Jose
Software Engineer, Flash Builder
Copy link to clipboard
Copied
I am sorry to bother you again.
I have tried the web site content, but it can't helped!
There is a custom component called 'Basket', source code is as follows:
package picnic
{
import mx.containers.Panel;
public class Basket extends Panel
{
public function Basket()
{
super();
layout = "vertical";
setStyle("backgroundColor", 0x00FFFF);
setStyle("horizontalAlign", "center");
}
}
}
Here it is worked when the attribute "layout" is set to "vertical", but it isn't when "layout" is set to "absolute" !
When the property is set to "absolute" phenomenon is as follows:
Drag component such as 'Button' into "picnic component". It will automatically go to the top left corner position,
just like the 'layout-attribute' is not set.
Why is there such a phenomenon?