View Full Version : Flex / AS3 / Controls (Text Input, etc).
MrSparky
July 20th, 2007, 06:03 PM
Hey,
So I'm working with Flex 2.0, using the command-line compiler (avoiding using Flex Builder 2 as I don't want to get used to it, have the trial-period run out, and be stuck without it! So not downloaded it!) with AS3.
My problem is creating things with objects that otherwise exist in the fl.* files. These aren't available outside of Flash CS3 (or are they?) so I can't do, for instance, import fl.controls.TextInput;
I always just use .AS files - is it worth creating .MXML files, and if so how and why? Do these allow for fl.* to be used, as they appear to in samples I've seen?
Advice would be very much appreciated!
Sirisian
July 20th, 2007, 08:30 PM
Save yourself the time and just use FlashDevelop. There's no need for the MXML files. You just use .as files.
http://www.flashdevelop.org/communit...pic.php?t=1592
That's the newest build. It runs just fine. If you choose to use flashDevelop all you have to do is install it then goto tool->installed plugins then click on AS3 context then click settings then in the Flex 2 SDL location set the folder where the Flex 2 SDK is. Then when making a project (by clicking Project->New Project and selecting Empty AS3 project) you must set the debug drop down to release and go into: project->properties then at the bottom of that window it says, "open swf in:" set that to external.
There you're done.
Another thing to note when you make a project in the project outline there's a button that says show hidden items, click that. Then for your main class that you create remember to extend Sprite and right click on it in the outline and select "Always Compile"
As for the question: I have no idea. I'm just making my own GUI. :)
MrSparky
July 21st, 2007, 03:46 AM
Thanks for your reply, Sirisian :-)
I already just use .AS files and have read similar posts that they're all that's needed, but now starting to feel that may not be the case. Because the FL.* packages are not available within .AS files but are from either within .MXML files or from the Flash CS3 IDE, that suggests that using .MXML almost unlocks extra functionality... Anyone's thoughts on this?
How are you doing your own GUI then? What building blocks are available for making objects such as input boxes?
Thanks
Mark
Sirisian
July 21st, 2007, 04:58 PM
My GUI is a recursive hierarchy in which the base component class has an array of components. For instance, at the top I have windows and such which if one is clicked on then recursively the mouse data is sent through the window to it's components to check and event. I have my own event system to manage what the GUI does. However, GUI programming can be overwhelming and tedious to inexperienced programmers, so it might not be a good thing to start trying. Like the idea that components and parent components take focus. So if you click on a textbox it gives it focus so keyboard input is directed to it.
For rendering let's say in case you ever want to know this I use a set of buffers on every "layer" of the GUI to minimize rendering. It's just a bunch of bitmapData objects for every component so the parent component renders it's children to it's buffer. As long as events never come from the children then the top buffer is just rendering allowing 100's of components to exist in windows without any rendering overhead normally. Again this can be kind of complex if you haven't thought about it before.
Keyboard input is easy: Instead of me explaining it:
Clicky (http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000311.html)
Database_Dorset
August 1st, 2007, 05:13 PM
I have been attempting to tackle a similar problem... possibly even the same problem...
I am trying to do some straight forward transfer of an AS3 flash class (which compiles and works fine in CS3) into a flex project.
I created a new AS3 class in my flex project and then transferred the AS3 code out of my flash AS3 (.as) file into this class.
Then I tried to compile it.
I discovered I was missing the fl. libraries, so...
I made a reference to the fl folder on my c drive (under C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\Component Source\ActionScript 3.0\User Interface\fl) , and the fl. start showing up in the intelisense in Flex as I expected.
Eg. at the top of the class I import:
import fl.controls.*;
import fl.events.SliderEvent;
But when I come to compile the AS3 class which compiles fine in Flash, I am getting compile errors like: “1046: Type was not found or was not a compile-time constant: SliderEvent”.
Anyone know a foolproof way how I take a working Flash .as class, and compile it in Flex? (I mean one that makes use of some of these fl. libraries.)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.