The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Using vectors (typed arrays) with Flex 3?

  1. #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; October 31st, 2008 at 04:02 PM.

  2. #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.

  3. #3
    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

  4. #4
    1,596
    posts
    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

  5. #5
    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?

  6. #6
    1,596
    posts
    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

  7. #7
    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

  8. #8
    1,596
    posts
    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?
    Last edited by wvxvw; October 31st, 2008 at 07:01 PM.

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

  9. #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?)

  10. #10
    1,596
    posts
    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

  11. #11
    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?

  12. #12
    1,596
    posts
    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

  13. #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

  14. #14
    1,596
    posts
    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
    Last edited by wvxvw; October 31st, 2008 at 09:12 PM.

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

  15. #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

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012