Personal tools

Views

Talk:Flex Component Kit for Flash CS3

From Adobe Labs

Table of contents
[edit]

Welcome!

Welcome to the Flex Component Kit for Flash CS3 discussion page on Adobe Labs. Please enter your comments regarding this technology here. To help identify the author of comments, please create a new section and use ~~~~ at the end of your talk entries to automatically create a signature.

Comments should be added in list format, but feel free to add your comment under an existing comment to follow a thread structure. If you are responding to a thread, please use the H3 style for your subject (=== TEXT ===) so that the page is easier to read.

Daniel T 14:58, 23 Apr 2007 (PDT)

[edit]

Using Folders in Flash CS3

I created a Folder in my FLA symbol library: Cover Button Assets. Into this folder I created my skin symbols: Cover Button Up Skin (aka CoverButtonUpSkin) etc.

When I selected "Export for ActionScript" the class name created was CoverButtonAssetsCoverButtonUpSkin.

It would be nice if either a) the folder were used as a package: CoverButtonAssets.CoverButtonUpSkin or b) not used at all.

I know I can change the name of the class, but it wasn't what I expected to happen. I actually thought the folder would be ignored as I was using it to organize my symbol library.

peterent 08:25, 7 May 2007 (PDT)

Thanks for the report. This is a bug.

The class name should not include the folder name. In the meantime, you can either rename the class, or move the symbol out of the folder before running the "Make Flex Component" command. Once the command has been run, the symbol can be moved into a subfolder without affecting the class name.

Glenn Ruehle 09:09, 8 May 2007 (PDT)

[edit]

Resizing

I am disappointed by the handling of the initial size of Flash components using percentage. They will be set at the size defined in the FLA and will not be sized within the Flex layout. The resizing will be fine if you use width="200" but not with width="50%". It makes all very complicated. --Thaneros 00:40, 14 May 2007 (PDT)

Response: Percentage sizing is not working in absolute layouts. As a workaround, you can use horizontal/vertical layouts or put your contents inside a VBox. This is a bug that will be fixed in a future release. Glenn Ruehle 11:00, 16 May 2007 (PDT)

[edit]

Class properties/methods in Flex

Like Glenn's yellowdot example in the presentation, I'm making a custom class for the MovieClip I'm exporting. Once I export that MovieClip, the code hinting doesn't show any of the methods or properties from my class that I would like to call in Flex. I also can't call any of those methods or properties. Is this something that is supported that I'm just doing wrong, or is it not supported at this point?

Response: This should work. Did you apply the Flex 2.0.1 patch for Flash CS3? Can you try removing and then re-adding the SWC file in the Library Path settings? Glenn Ruehle 11:14, 16 May 2007 (PDT)

Also, the MovieClip linkage menu in Flash CS3 basically tells me that the class I'm using already is defined and has a base class, so I'm forced to use MovieClip (the default) as the base class(in the linkage menu, even though my class itself extends UIMovieClip). Its the only input that doesn't generate an error of some sort. I'm wondering if thats just the default value, or if it was intentional that it work that way.

Response: This is the way the Linkage Properties settings work. The base class field is only used when Flash is auto-generating a class. When a custom class is used, the base class field is ignored, but will give an error if it is not set to flash.display.MovieClip. Glenn Ruehle 11:14, 16 May 2007 (PDT)

[edit]

stop() not being called within movieclip

The stop() method is not being called within movieclips that are nested within a movieclip that is nested within a parent movieclip. Say I have a room mc, within that I have a light mc, and inside that a bulb mc. Code on the timeline of the room will work fine, and on the light, but if I put a stop() on the first frame of the bulb mc, it is not being called. Of course, this only happens when using the Flex component kit and viewing the animation within a Flex app. Running directly from Flash CS3, all is fine.

forty6n2 18:52, 15 May 2007 (PDT)

Response: Did you apply the Flex 2.0.1 patch for Flash CS3? The problem you are describing is fixed in that patch.

Glenn Ruehle 11:04, 16 May 2007 (PDT)

[edit]

UIMovieClip list of properties

The Flex Component Kit for Flash CS3 turns a movieclip into a Flex component whose base class is mx.flash.UIMovieClip

Looking at the code hint for the <local:> tag and comparing with the UIComponent list of properties, it appears that almost all of them are present for a component created from Flash CS3. Only some are missing like styleDeclaration or styleName. Is there a complete list of the UIComponent properties, methods and events not supported by UIMovieClip ?

Does UIMovieClip extend UIComponent or does it replace it ?

Karl_Sigiscar_1971 04:56, 17 May 2007 (PDT)

The documentation zip file includes ASDoc for UIMovieClip. This lists all supported events, properties, and methods.

[edit]

Flash Component MovieClip children appear in FlexBuilder hints

Question: Any clip on stage inside of a component created in Flash CS3 must be public. The members become visible in Flex Builder code hinting when the SWC is generated from the component then added to a Flex project.

How can I hide these properties from the Flex Builder Hinting system?

[edit]

Importing Flash CS3 Components

HI,

I am trying to use the "Flex Component Kit for Flash CS3" to import Flash applications into Flex so they can be converted into an Apollo application. The Extension seems to work except for the fact that if a flash cs3 component is included either inside the flash SWC or purely in actionscript it is unable understand how to use the component and all you see in flex is it playing the frames of the elements of the component. Also Flex only seems to understand actionscript in the root of the movieclip if it is nested then flex just ignores it. These problems may be related. Any help would be much appreciated Thanks. Dave

David August 12:39, 21 May 2007 (PDT)

Response: Did you apply the Flex 2.0.1 patch for Flash CS3? The problem with ignoring scripts in nested movie clips is fixed in that patch.

[edit]

Flex Component's Custom Event

Hello! I'm working on a project, where I'd need to use custom events, which have extra propertys. The Flex Component Kit Documentation has a small chapter about using these kind of events on page 789, but couldn't get along with it. I was so confused, that after trying for several hours, I tried to compile the sample code (EventBlueSqare), but still couldn't use it's dispatched events in flex builder although those are children of flash.event.Event, not an extended class... I carefully read 2.0.1 patch installation notes, everything is set up fine, my SWC is compiling without errors, working correctly in flex, even if I attach an EventListener to the UIMovieClip in flash's actionscript listening to the custom event, it provides the requested action, but flex says "Cannot resolve attribute"... Tryed importing events from flex, also metadata tags, nothing. Anyone having the same problem? Do I need to set some other settings in Flash or maybe Flex? Any solutions would come handy.

AS____________________________________________________________

package {

 // EventBlueSquare.as
 import mx.flash.UIMovieClip;
 import flash.events.*;
 import flash.net.*;
 
 [Event(name="blueSquareSelected", type="flash.events.Event")]
 
 public class EventBlueSquare extends UIMovieClip {
   public function EventBlueSquare() {
     super();
     addEventListener('mouseDown', dispatchMyEvent);
     addEventListener('blueSquareSelected', eventCatch);
   }
   protected function dispatchMyEvent(event:Event):void {
     dispatchEvent(new Event("blueSquareSelected"));
   }
   public function eventCatch(event:Event):void {
     navigateToURL(new URLRequest("javascript: alert('Custom event occured in "+this.name+"')"),"_self");
   }
 }

}

MXML__________________________________________________________

<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:myComps="*">

 <mx:Metadata>
   [Event(name="blueSquareSelected", type="flash.events.Event")]
 </mx:Metadata>
 
 <mx:Script>
   <![CDATA[
     
     import flash.events.Event;
     
     public function handleBlueSquareSelected():void {
       myTA.text='blueSquareSelected event occured.';
     }
     		
   ]]>
 </mx:Script>
 
 <myComps:EventBlueSquare id="ebs" blueSqareSelected ="handleBlueSquareSelected();"/>
 
 <mx:TextArea id="myTA" />

</mx:Application>

______________________________________________________________

If anyone can get this work, please tell me about it, maybe I'm having some sort of program errors from previous works. Thanks for your time:

Barney 12:24, 24 May 2007

Your sample code has a typo: "blueSqareSelected" is missing a "u". Everything else looks correct. (The Event metadata in the mxml file is not required, but should not be causing any harm).

______________________________________________________________

This is July and I am wondering did anyone get this working? I'm ready to take flex apart at this stage, component by component. Can anyone offer a pointer here or there?

[edit]

Same names of Symbol and FLA

Having the same names for your fla, and UIMovieClip Symbol can cause flash to display compiler errors occurred, but no compiler errors in the list. Seems, that when export swc is checked, and the project is published, it puts the swc file right next to the swf and fla (if not set otherwise). From the time, the swc exists, errors will occur. The solution I found is after running the make Flex Component command uncheck the export swc in publish settings, and export the swc from the library into an other folder... Otherwise flash will try to import the old swc into the new one, I guess... (?)

Barney

Nice catch. It would be best to just rename the FLA file (or the symbol/class) so they are not the same.

Glenn Ruehle 15:25, 4 Jun 2007 (PDT)


[edit]

using the fl.* packages in classes that extend UIMovieClip (in Flash CS3)

I read that the Flex compiler doesn't understand several Flash packages, and my error seems to follow along with this. When I extend UIMovieClip for a custom class for a MovieClip in flash that I want to export as a Flex component, I cannot access the fl.video package in any way. The fix for this problem if you are trying to code flash projects in flex seems to be fairly easy (just add the class path), but to export in Flash CS3 as a component for Flex doesn't seem to work at all. Is there a temporary work around for this?

As an example, if I make a movieclip in CS3 and use this class for it, then click to make it a Flex Component, I get a not recognized error for the VideoProgressEvent import:

package {

     import fl.video.VideoProgressEvent;
     import flash.display.MovieClip;
     import mx.flash.UIMovieClip;
     
     public class Test extends UIMovieClip
     {
        public function Test() : void { }
     }

}


[edit]

Seamless Accessibility between Flex and UIMovieClip

I'm trying to make the great accessibility features of a flex app extend seamlessly into the custom flash UIMovieClip component. The tab index is set up in Flash and Flex but flex seems to hog the focus unless you force focus into the flash UIMovieCilp component. Any hints, documentation or examples on this would be welcome.

After note: Solution: Use the flex builder 3 component kit to create the swc in flash. Using this sorts the accessibility issue. To get this you require the flex 3 beta/ alpha which also bundles the v3 kit

Ged

[edit]

Dynamically loading flash UIMovieClip Content

Can anyone suggest a best practice for loading flash UIMovieClip Content dynamically so that it can be loaded into a flex app without previously being merged into the compiled app. I've tried using an external library / SWC and RSL but it doesn't (seem to) work. I know swfloader and module loader will work but these are cumbersome. Can it be achieved in theory? using RSLs perhaps ? Ged.

[edit]

Any know issues with Flex Automation?

Are there any known issues using Flash CS3 components built with the Flex Component Kit beta inside Flex 2.0.1 applications that are compiled with the QTP automation libraries (automation.swc, automation_agent.swc, qtp.swc)?

sparky1962 11:41, 2 Jul 2007 (PDT)

[edit]

Flash / Flex embedded font bug?

In flash, create a simple movie clip with text fields (static / dynamic) containing a bitmap font - e.g. Myriad Pro. Publish an swc using the Component Kit.

In Flex, embed the same font with the exact same fontFamily name (I did it through embedding a different .swf containing the bitmap font; haven't tried it with ttf fonts).

Embed the Flash component into Flex and I found that my embedded Flex fonts (above) are now not rendered.

[edit]

Using Custom Class Definitions and Loading MC Instances from the Library

Here's what I'm trying to do: I have one mc "Squares" that has a custom class definition. The class extends UIMovieClip. In the constructor of that class I'm creating instances of a different mc, "MySquare" in my library, like this:

 var square_1:MovieClip = new MySquare();
 addChild(square_1)

MySquare has a little 10x10 square drawn on it's stage.

I load five of the MySquare mc's in a neat little row. This works fine when I run it in Flash, but when I bring the swc into Flex and create an instance of my main movie clip nothing gets rendered on the stage. I can see trace output for both the Squares constructor and the MySquare constructor, so I know they are getting called. But I can't figure out why they aren't getting rendered. Is dynamic loading of movie clips supported in a Flex component generated in Flash CS3?

ONE NOTE: The MySquare mc also has a custom class definition. I've tried extending both MovieClip and UIMovieClip, but neither seems to work.

ONE MORE NOTE: I have an example working where Squares loads a version of MySquare that does not have it's own class definition. But when MySquare has it's own class definition, anything on stage in MySquare does not get rendered.

thanks,

Christian


Here's the ANSWER:

The reason nothing was rendering was because the square symbol on stage does not get rendered when the mc has a custom class. (Why I still don't know.) But here's the working approach:

Squares - an mc that is convereted to a Flex Component (with a custom class that extends mx.flash.UIMovieClip)

MySquare - an empty mc (with nothing on the stage) that has a custom class definition and extends MovieClip; Squares creates several new instances of this symbol using new MySquare();

Square - a separate mc in the library that has a square on the stage but does not have a custom class definition; MySquare creates a new instances of this using new Square();

If anyone is interested I can post the full code example online and add a link to this blog.

[edit]

Does Flex 2.0.1 Hotfix 3 include the CS3 Component Kit?

If not, which should you install first? Does installing the hotfix mean you need to redo the steps involved with installing the Component Kit? sparky1962 03:01, 26 Jul 2007 (PDT)


[edit]

Potential problems when including custom classes in Flex library path

When exporting a Symbol/SWC from Flash, you might run into troubles, when the symbol's associated CUSTOM class lays within the (default) library path of the targeted Flex application.

For instance when you have both, the symbol's *.swc and its associated custom *.as class file in the same Flex directory, Flex might, at compile time, interpret this class file as a native, standalone class, and therefore will ignore the associated resources, that normally come together with the SWC.

However, when Flex interprets the *.as file as a native class rather than being related to a *.swc context, we most probably will run into Flex compilation errors as soon as this class refers to the symbol's internal Flash resources (e.g. MovieClips).

This is because when the class is used as a symbols custom class, the symbol's internal objects are not explicitly declared in the symbol's custom class (when you do you will get, within Flash, compilation errors ), but when used as a (Flex) standalone class (and as such it will be considered by Flex when being found in its (default) Flex library path) the Flex compiler considers those Flash resource objects as non declared, and therefore will either not compile at all, or will not correctly load such associated resources.

--Humanaut 05:15, 15 Aug 2007 (PDT)

[edit]

Textfields not accessible anymore

We have a Clock component with an animated graphic background and dynamic textfields on top. The component movieclip has no custom class assigned to it.

This component has been created from Flash with the Kit. We use the relevant JARs update and Hotfix. The component is included in an MXML file which is in turn instanciated from Main.mxml

We used to be able to change the content of the textfields in this component from Flex. EVERYTHING USED TO WORK. And then, one day, it stopped working.

There were some code modifications in the project since but they do not affect neither directly nor indirectly this component, nor the MXML file that includes it.

When superimposing Flex textfields on top and binding to the same model, the app works... so it's not a binding problem either.

An interesting point is that when running in debug mode, we can see the textfields in the Variables tab in Eclipse and even see their value change but there is no visual update of them.

[edit]

Custom Events Part II

Good day,

i'm having some trouble with the following situation: i have to embed a swf map of my country in my flex application. the flash map is made of buttons which represent the prefectures of my country. i want when the user clicks on a prefecture the flex application to display lets say the partners i have in the selected region. All the samples i saw up till now treat the swf as a single object. Is there a way to do this.

Thanks in advance. Yiannis Tsakiridis

---

Read Chapter 34 of "Flex 3 Developer's Guide" - it describes how to broadcast events from Flash to Flex. What is omits is how to send data along with the flash.events.Event.

[edit]

Wouldn't it make sense to create a "flac" command line compiler?

We're already using the Component Kit pretty heavily in our Flex application. We have an automated build process that uses Ant and the Flex Ant Tasks to build the SWF. Unfortunately we have to remember to build the Component Kit-built components by hand using the Flash IDE. Wouldn't it make sense to release a command line compiler that could build a SWC from a FLA that could be invoked from an automated build process? sparky1962 01:39, 28 Sep 2007 (PDT)sparky1962

[edit]

How can the Flash Component invoke functions or web services in Flex?

I'm building a pretty simple component in Flash and need to access a few things that sit on the application in Flex. Here’s what I have in Flash:

Two MovieClips

1 - A "Radar", flat circle that I can plot point on. 2 - Pointers (dots) that are the points to be plotted on the radar.

Each dot represents a project on the Radar. Once I get the XML (in Flex) that holds some basic info for all the projects, I'm passing some of that info (id, title, startDate, endDate) into an array in the Radar class. That's what I'm using to plot the points. Then my class for the points on a click event needs to pass an id to a web service that gets the rest of the info of that project to be displayed in another component in Flex. And that's the part I can't get done. I'm not able to see anything on the main Flex app (functions, vars, you name it).

Here's the basics of the Flash script....

addEventListener("click", clicker);

protected function clicker (event:Event):void { //web service (does NOT work) ws2.GetGlobalRadarFullById.send(); //get's the dates Array in the Radar movieClip in the Flash (works) trace((parent as MovieClip).dates); }

Mark


Mark.P. 05:36, 3 Oct 2007 (PDT)

Hi,

I have a dynamic text filed in a movie clip that has been published as an SWC. I could import it into Flex, but don;t quite know how to get access to the text property of the dynamic text field in the movie clip, and change the value.

Any help?

Thanks,

-v


[edit]

What happened to the replacement jars?

When it was first released the Component Kit included replacements for fdb.jar, mxmlc.jar and swfkit.jar for Flex Builder/SDK 2.0.1. These jars seem to be missing from the kit on Adobe Exchange. Are they no longer needed? Have they been included in a "hotfix" for Flex 2?

sparky1962 09:38, 18 Dec 2007 (GMT)

[edit]

Unable to use cs3 component in Flex

I´ve coded a flash cs3 component, it runs without problems as a swf file, but when I try to use the swc in flex i get this error : "VerifyError: Error # 1107: The ABC data are damaged; they try to read outside the limits. " I have others swc in the project and they run smooth and clean, but this one gives me the error. If I create a new flex project and load only this swc in the lib folder, the application runs but the component shows up without rendering all of its content. (this component is an animated truck and the tires don't show up)

What is happening?

using xp , flex 2.01 .

thanks in advanced

update: I´ve applied the sdk hotfix 3 and now the error shows up in both projects, the one with a single component and the other one with several components

Retrieved from "http://labs.adobe.com/wiki/index.php/Talk:Flex_Component_Kit_for_Flash_CS3"