Results 1 to 15 of 16
October 31st, 2008, 03:03 PM #112Registered User
Using vectors (typed arrays) with Flex 3?
I've downloaded Flex 3 and got it working, and I'm trying to create a vector array of integers using the line of code below, but when i compile I get an error highlighting "Vector" and saying it's not a compile time constant. I'm a total newb to Flex (i only got it working thanks to senoculars tutorial), so I'm wondering if there's some extra thing i have to download to use Flash Player 10 stuff like vectors? Or is there something else I'm doing wrong? I downloaded Flex 3 from adobe's website fairly recently...
var thing:Vector.<int>=new Vector.<int>;
Last edited by somerandomdude; October 31st, 2008 at 04:02 PM.
October 31st, 2008, 03:48 PM #2
It isn't Vector.
Look up Sprite.graphics, it has tools to draw lines, circles, gradients, rectangles, and pretty much everything you have in the Flash Drawing IDE, except turned into code.
If you want to load up images you created externally via flex rather than loading up library assets in flash, create something in Photoshop and load it up using the <mx:Image/> component, a lot easier than trying to manually code vectors.
October 31st, 2008, 04:01 PM #312Registered User
October 31st, 2008, 04:14 PM #41,596Holosuite User
This should help.
But, as far as I can tell you're not using Flex SDK 4 (Vector support starts with SDK 4, though you can use FB3 with this SDK).
See this page for instruction on setting your FB to use with FP10 (SDK 4)
October 31st, 2008, 04:47 PM #512Registered User
October 31st, 2008, 05:11 PM #61,596Holosuite User
I'd go for the last one Being honest I'm surprised it's already considered a "release" version... thought it's still in beta... but, apparently it's not, as long as there's Flash CS4... but that's just me being not updated I'd say that, if you're planning on releasing whatever you develop for FP10 in less than, ughm... maybe half a year, this would be considered "experimental", and you may have problems explaining to the customers they have to update the player
October 31st, 2008, 05:20 PM #712Registered User
I downloaded the latest one, but it still doesn't recognize the Vector class I configured it to target Flash Player 10, so I don't know what the problem is
October 31st, 2008, 06:02 PM #81,596Holosuite User
Does it recognize it at least? meaning, does it highlight the word Vector / offers autocomplete options while you type it? And, BTW, usually you want to call constructors with (), so, your code should be:
var thing:Vector.<int> = new Vector.<int>();
even though, it's not mandatory, it's better to write it that way.
Another question: can you compile your project not from the IDE (just by running [your path to SDK]Flex_4_SDK\bin\mxmlc.exe) ?
Can you post your build file, if not?
Last edited by wvxvw; October 31st, 2008 at 07:01 PM.
October 31st, 2008, 07:36 PM #9
Checking if it highlights isn't necessarily going to tell you if it supports it, setTimeout is supported and yet doesn't highlight and doesn't have code hints (In the Flash IDE anyways. I've only used it once since I started AS3, haven't tried in FB3 for Linux )
Stupid question, but I do this relatively often: Did you check if you're importing it? (Haven't played with this new Vecotr Class, I somehow didn't even know SDK 4 was available... is it out for Linux yet?) I know FlexBuilder automatically places import statements for most common classes like URLLoader, Rectangle, Bitmap... I doubt Vector would be there yet (flash.display.Vector, would it be?)
October 31st, 2008, 07:47 PM #101,596Holosuite User
Vector is a core class, so, you don't need to import it...
SDK 4 should be available for Linux... but you don't really need the whole SDK to compile FP10 content. What you need is a new playerglobal.swc and to set the compiler to -target-player=10.0.0. There're few more changes in the build file, like adding new intrinsic classes and new locale library.
And... to be honest I don't know if there actually is code hinting for Vector class in FB, but the help page says it should be... I'm using FD, and, they ware the first to support Vector syntax
October 31st, 2008, 08:04 PM #11
So I just DL the FP10 Debugger, modify playerglobal.swc and update compiler directives? Sounds easy to me!
*Backs up everything and gets ready to try it*
Wait... so what other than a new Vector class is in store if I DL the update?
October 31st, 2008, 08:19 PM #121,596Holosuite User
__AS3__.vec:Vector __AS3__.vec:Vector$double __AS3__.vec:Vector$int __AS3__.vec:Vector$object __AS3__.vec:Vector$uint adobe.utils:MMEndCommand flash.desktop:ClipboardFormats flash.desktop:ClipboardTransferMode flash.display:GraphicsBitmapFill flash.display:GraphicsEndFill flash.display:GraphicsGradientFill flash.display:GraphicsPath flash.display:GraphicsPathCommand flash.display:GraphicsPathWinding flash.display:GraphicsShaderFill flash.display:GraphicsSolidFill flash.display:GraphicsStroke flash.display:GraphicsTrianglePath flash.display:IGraphicsData flash.display:IGraphicsFill flash.display:IGraphicsPath flash.display:IGraphicsStroke flash.display:ShaderData flash.display:ShaderInput flash.display:ShaderJob flash.display:ShaderParameter flash.display:ShaderParameterType flash.display:ShaderPrecision flash.display:TriangleCulling flash.events:SamplesCallbackEvent flash.events:ShaderEvent flash.filters:ShaderFilter flash.geom:Matrix3D flash.geom:Orientation3D flash.geom:PerspectiveProjection flash.geom:Utils3D flash.geom:Vector3D flash.media:SoundCodec flash.net:NetStreamInfo flash.net:NetStreamPlayOptions flash.net:NetStreamPlayTransitions flash.system:JPEGLoaderContext flash.text.engine:BreakOpportunity flash.text.engine:ContentElement flash.text.engine:DigitCase flash.text.engine:DigitWidth flash.text.engine:EastAsianJustifier flash.text.engine:ElementFormat flash.text.engine:FontDescription flash.text.engine:FontLookup flash.text.engine:FontMetrics flash.text.engine:FontPosture flash.text.engine:FontWeight flash.text.engine:GlyphRotation flash.text.engine:GraphicElement flash.text.engine:GroupElement flash.text.engine:JustificationStyle flash.text.engine:Kerning flash.text.engine:LigatureLevel flash.text.engine:LineJustification flash.text.engine:SpaceJustifier flash.text.engine:TabAlignment flash.text.engine:TabStop flash.text.engine:TextBaseline flash.text.engine:TextBlock flash.text.engine:TextElement flash.text.engine:TextJustifier flash.text.engine:TextLineCreationResult flash.text.engine:TextLineMirrorRegion flash.text.engine:TextLineValidity flash.text.engine:TextRotation flash.text.engine:TypographicCase flash.ui:ContextMenuClipboardItems flash.ui:MouseCursor
Ah, and there're new props of DO, like "z" or "rotationZ".
October 31st, 2008, 08:42 PM #13
MouseCursor and the 3d utils interest me.
Could you please point me to the exact steps I need? Update compiler directives, do what to playerglobal.swc, and then just install FP10 debugger right?
I'm bringing this so far off topic
I haven't touched the new Vector class, if I had I'd post some wise comment about a solution, then someone else would come along and immediately optimize my code and make a mockery of me
October 31st, 2008, 09:05 PM #141,596Holosuite User
here it explains how to configure FB to compile for FP10.
But what I've been doing and it worked so far: downloaded the SDK4, extracted it to some folder, say C:\Flex_4_SDK. Then written this BAT file:
set sdk=C:\Flex_4_SDK\bin\mxmlc.exe set buildfile=config.xml set outputfile=D:\projectsFP10\bin\testFP10.swf set exec=%sdk% -load-config+=%buildfile% -debug=true -incremental=true -benchmark=false -output=%outputfile% call %exec% pause
<?xml version="1.0" encoding="utf-8"?> <flex-config> <compiler> <source-path append="true"> <path-element>d:\projectsFP10\src</path-element> <path-element>C:\Program Files\FlashDevelop\Library\AS3\classes</path-element> </source-path> </compiler> <file-specs> <path-element>d:\projectsFP10\src\Main.mxml</path-element> </file-specs> <default-background-color>#FFFFFF</default-background-color> <default-frame-rate>30</default-frame-rate> <default-size> <width>200</width> <height>200</height> </default-size> </flex-config>
(this particular example will compile d:\projectsFP10\src\Main.mxml as the document class of the D:\projectsFP10\bin\testFP10.swf.
I believe that there will be not much difference on Linux, except for backslashes and such.
What I haven't managed is to redirect output to the FD console (and I don't really know how to redirect it to the Eclipse console), so, I use it with Flash Tracer plugin in FF (it reads trace messages from the log file created by the player), but maybe there's a better way to do it, just haven't investigated it enough...
* you don't need this line:
Last edited by wvxvw; October 31st, 2008 at 09:12 PM.
October 31st, 2008, 09:29 PM #15
All my trace operations go to the eclipse console. I just installed FP9 debugger when I installed the Flex plugin for eclipse and voila, traces to the console panel right next to where I code the files and hit F11 to debug (So used to ctrl-enter though...)
I don't need to use the bat file (which is easier in a linux shell to code, by the way), since F11 in Eclipse runs the compiler with the set directives that I specify in my preferences Config.xml is auto-generated for me and I can modify it.
All I have to do if this is as you say is install the SDK4 to a directory I already have and update my preferences. I love Linux