Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 10-31-2008, 04:03 PM   #1
somerandomdude
Registered 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...

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..
somerandomdude is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 10-31-2008, 04:48 PM   #2
theCodeBot
Hey, I'm working on it.
 
theCodeBot's Avatar
Location A gargantuan hole, Michigan

Posts 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
theCodeBot is offline   Reply With Quote
Old 10-31-2008, 05:01 PM   #3
somerandomdude
Registered User
Quote:
Originally Posted by theCodeBot View Post
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
somerandomdude is offline   Reply With Quote
Old 10-31-2008, 05:14 PM   #4
wvxvw
Holosuite User
http://www.mikechambers.com/blog/200...ash-player-10/
http://livedocs.adobe.com/flex/gumbo...e.html#Vector()
http://livedocs.adobe.com/flex/gumbo...ef/Vector.html
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)
http://opensource.adobe.com/wiki/dis...Player+10+Beta

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 10-31-2008, 05:47 PM   #5
somerandomdude
Registered User
Quote:
Originally Posted by wvxvw View Post
http://www.mikechambers.com/blog/200...ash-player-10/
http://livedocs.adobe.com/flex/gumbo...e.html#Vector()
http://livedocs.adobe.com/flex/gumbo...ef/Vector.html
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)
http://opensource.adobe.com/wiki/dis...Player+10+Beta
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?
somerandomdude is offline   Reply With Quote
Old 10-31-2008, 06:11 PM   #6
wvxvw
Holosuite 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

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 10-31-2008, 06:20 PM   #7
somerandomdude
Registered 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
somerandomdude is offline   Reply With Quote
Old 10-31-2008, 07:02 PM   #8
wvxvw
Holosuite 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?

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it

Last edited by wvxvw; 10-31-2008 at 08:01 PM..
wvxvw is offline   Reply With Quote
Old 10-31-2008, 08:36 PM   #9
theCodeBot
Hey, I'm working on it.
 
theCodeBot's Avatar
Location A gargantuan hole, Michigan

Posts 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
theCodeBot is offline   Reply With Quote
Old 10-31-2008, 08:47 PM   #10
wvxvw
Holosuite 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

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 10-31-2008, 09:04 PM   #11
theCodeBot
Hey, I'm working on it.
 
theCodeBot's Avatar
Location A gargantuan hole, Michigan

Posts 675
Quote:
Originally Posted by wvxvw View Post
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
theCodeBot is offline   Reply With Quote
Old 10-31-2008, 09:19 PM   #12
wvxvw
Holosuite User
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".

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 10-31-2008, 09:42 PM   #13
theCodeBot
Hey, I'm working on it.
 
theCodeBot's Avatar
Location A gargantuan hole, Michigan

Posts 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
theCodeBot is offline   Reply With Quote
Old 10-31-2008, 10:05 PM   #14
wvxvw
Holosuite User
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

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it

Last edited by wvxvw; 10-31-2008 at 10:12 PM..
wvxvw is offline   Reply With Quote
Old 10-31-2008, 10:29 PM   #15
theCodeBot
Hey, I'm working on it.
 
theCodeBot's Avatar
Location A gargantuan hole, Michigan

Posts 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
theCodeBot is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:41 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com