Depending on what you want to achieve with the component, you can write it as an ActionScript file and put it in a directory where Flex can find it. The simplest is to put it in the same directory as the file where you want to use it.

So say you had the code below saved as CustomPanel.as

You could call it from within an MXML file in the same directory like this:


CustomExample.mxml ******************* <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; xmlns:user="*">

<user:CustomPanel id="myPanel" label="click to maximize" />
<mx:Button label="Click to resize panel." click="myPanel.resize(400,500);"/>


</mx:Application>
********************


CustomPanel.as ***************************** import mx.containers.Panel;

class CustomPanel extends Panel {

function CustomPanel() {
super();
}

function resize(newWidth:Number,newHeight:Number) {
width = newWidth;
height = newHeight;
}
}
**************************************


Depending on exactly what you want to do in ActionScript, you may or may not be able to achieve it without going into Flash Studio and creating a .swc file.


Does that answer the question?

Spike

JesterXL wrote:
Coding it in Flash isn't hard... it's installing the mofo that I don't know how to do. The docs say you can use an SWC, but where said SWC goes, is beyond me. I managed to throw one in here:

C:\Program Files\Macromedia\Flex Builder 1.5\Configuration\Objects\MXML\WEB-INF\flex\frameworks

ANd it shows up as a "no package" tab when you reboot FlexBuilder, but has no size when dragged to a form (even though width and height default to values), nor does it compile, complaining about my classpath or something.

Anyway, that's the key part that's missing I think. DevNet article anyone?

----- Original Message ----- From: "dduuggllaa" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 15, 2005 9:34 AM
Subject: [flexcoders] Still Need Example of Custom Component Built in Flash





Hello,

Would someone be willing to post a simple example of a custom
component built in Flash for use in Flex? The simpler the better. Thanks.

-Douglass Turner







Yahoo! Groups Links









Yahoo! Groups Links









--

--------------------------------------------
Stephen Milligan
Code poet for hire
http://www.spike.org.uk

Do you cfeclipse? http://cfeclipse.tigris.org




Reply via email to