10-31-2008, 04:03 PM
|
#1
|
|
|
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...
Code:
var thing:Vector.<int>=new Vector.<int>;
EDIT: Btw, i'm using the Flex SDK, NOT Flex Builder
Last edited by somerandomdude; 10-31-2008 at 05:02 PM..
|
|
|
10-31-2008, 04:48 PM
|
#2
|

 |
A gargantuan hole, Michigan |
|
 |
675 |
|
|
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.
__________________
Sam: "So how's life been treating you, Tom?"
Tom: "Like it caught me sleeping with it's wife"
www.thecodebot.com
|
|
|
10-31-2008, 05:01 PM
|
#3
|
|
|
Quote:
Originally Posted by theCodeBot
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.
|
Hehe I'm talking about the Vector class, which allows the user to use typed arrays (arrays of ints, strings, sprites, etc) , not drawing with vector graphics. But thanks for the reply  I wish they didn't name the damn thing "vector"; i've been doing searches online and it's a pain in the *** sorting through all the results for vector graphics
|
|
|
10-31-2008, 05:47 PM
|
#5
|
|
|
Quote:
Originally Posted by wvxvw
|
Oooh you're right; I'm using SDK 3 not 4. Thanks! I see they only have "nightly builds" available, do you know if any one of those are more stable than any of the others?
|
|
|
10-31-2008, 07:02 PM
|
#8
|
|
|
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; 10-31-2008 at 08:01 PM..
|
|
|
10-31-2008, 08:36 PM
|
#9
|

 |
A gargantuan hole, Michigan |
|
 |
675 |
|
|
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?)
__________________
Sam: "So how's life been treating you, Tom?"
Tom: "Like it caught me sleeping with it's wife"
www.thecodebot.com
|
|
|
10-31-2008, 08:47 PM
|
#10
|
|
|
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 
|
|
|
10-31-2008, 09:04 PM
|
#11
|

 |
A gargantuan hole, Michigan |
|
 |
675 |
|
|
Quote:
Originally Posted by wvxvw
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 
|
Flex for Linux is actually just the mxmlc and a plug-in for eclipse. Installing was as easy as downloading the SDK and running the installer to unzip it to the right eclipse folders 
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?
__________________
Sam: "So how's life been treating you, Tom?"
Tom: "Like it caught me sleeping with it's wife"
www.thecodebot.com
|
|
|
10-31-2008, 09:19 PM
|
#12
|
|
|
Code:
__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
Not sure if this list reflects the last name changes, but should be close...
Ah, and there're new props of DO, like "z" or "rotationZ".
|
|
|
10-31-2008, 09:42 PM
|
#13
|

 |
A gargantuan hole, Michigan |
|
 |
675 |
|
|
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 
__________________
Sam: "So how's life been treating you, Tom?"
Tom: "Like it caught me sleeping with it's wife"
www.thecodebot.com
|
|
|
10-31-2008, 10:05 PM
|
#14
|
|
|
http://opensource.adobe.com/wiki/dis...Player+10+Beta
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:
Code:
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
to compile a project from this kind of build file (config.xml in the same folder where the BAT file is):
HTML Code:
<?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>
because all other settings related to the compiler version and new classes are already made to this flex-config file
C:\Flex_4_SDK\frameworks\flex-config.xml
(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:
HTML Code:
<path-element>C:\Program Files\FlashDevelop\Library\AS3\classes</path-element>
It's the FD tracing utility, but, as I say, I haven't managed to stick it to the player 
Last edited by wvxvw; 10-31-2008 at 10:12 PM..
|
|
|
10-31-2008, 10:29 PM
|
#15
|

 |
A gargantuan hole, Michigan |
|
 |
675 |
|
|
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 
__________________
Sam: "So how's life been treating you, Tom?"
Tom: "Like it caught me sleeping with it's wife"
www.thecodebot.com
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 04:41 PM.
|
|