ActionScript Project

I have an ActionScript Project and I have been running unit tests using the FlexUnit 4 integration in Flash Builder 4 Beta 2. These have been working great until I try to use UIImpersonator, which uses Flex classes and fails in my pure ActionScript project. (UIImpersonator works fine with a Flex Project.)
Since Flash Builder is for both Flex and ActionScript projects, I figured I would be able to use FlexUnit to equal extents. Is there an ActionScript project equivalent to UIImpersonator, or just a way to access the Stage?

I found this BDD project page, which includes a stage access example:
Cuke4AS3 https://github.com/flashquartermaster/Cuke4AS3/
[EDIT]
After much research and complication, I ended up using a Singleton that provides a stage reference that was passed in from a `creationComplete` handler in my TestRunner.
=======TestRunner.mxml==========================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="onCreationComplete()"
    xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
    styleName="flexUnitApplication"
    layout="absolute" height="800" width="1000">
    <mx:Script>
        <![CDATA[
            import org.flexunit.runner.FlexUnitCore;
            private var core:FlexUnitCore;
            public function onCreationComplete():void {
                core = new FlexUnitCore();
                core.addListener( new TraceListener() );
                core.addListener( new UIListener( uiListener ));
                new StageLocator(systemManager.stage);
                core.run(MyTestSuite);
        ]]>
    </mx:Script>
    <mx:Style>
        Application {
               backgroundColor: #3872b2;
               backgroundGradientColors: #3872b2, #0c1a3d;
               backgroundGradientAlphas: 1, 1;
               themeColor: #ffffff;
               color: #444444;
               fontFamily: "Myriad Pro Semibold";
               fontSize: 12;
    </mx:Style>
    <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" />
</mx:Application>
=======StageLocator.as==========================================
package {
import flash.display.Stage;
public class StageLocator {
    public static var instance:StageLocator;
    public static var stage:Stage;
    public function StageLocator ($stage:Stage) {
        instance = this;
        stage = $stage;

Similar Messages

  • SWC buttons not working in a Flash Builder 4.7 ActionScript Project

    Howdy,
    I have this BIG issue. Every button in my swc causes issues when compilling in Flash Builder 4.7. Two things will happen, one or the other:
    1. I get this error in the class that extends a linked library item:
    Error #1107: The ABC data is corrupt, attempt to read out of bounds.
    2. The swf compiles with no errors but all buttons display the wrong art.
    Both problems go away when I remove the buttons.
    I found this article:
    http://inflagrantedelicto.memoryspiral.com/2012/12/flash-builder-4-7-useflashsdk/
    I tried this solution but it did not work.
    This problem occurs with all my projects. I'm creating SWCs via Flash Pro, and using them in a Flash Builder ActionScript Project.
    Does anyone have any solutions?
    Thanks!

    Hi,
    I followed the directions here: http://inflagrantedelicto.memoryspiral.com/2012/12/flash-builder-4-7-u seflashsdk/
    But the only "Use Specific SDK:" options are Flex 4.6.0 and Flex 3.6a.
    When I select Flex 4.6.0 (under "Use Specific SDK:"), I get errors, it seems that some sub classes don't have access to their parents protected methods and properties. The only way to fix this is to delete the project and create it again.
    I downloaded the apache flex SDK, and added it via the Flash Builder preferences. Then went into the project and set "Use Specific SDK:" to the appache flex. This brought up more errors, double clicking the errors wouldn't take me to any class, they where mostly something about bitmap...
    And the only way to fix it is to delete the project and create it again.
    Should I not use Flash 4.6? or not use SWCs? This is really frustrating.

  • How to use HTTPSERVICE in Actionscript project.

    Hello all,
    I am doing an actionscript project, I want to use httpservice to send a data to server . Is any one knows how to use httpservice in actionscript project?
    thanx

    following code may help:
    import mx.rpc.http.HTTPService;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    private function callHTTPSERVIDE():void
    var hs:HTTPService = new HTTPService();
    hs.url = 'Server.php';
    hs.addEventListener( ResultEvent.RESULT, resultHandler );
    hs.addEventListener( FaultEvent.FAULT, faultHandler )
    hs.send();
    private function resultHandler( event:ResultEvent ):void
    //handle your result here
    private function faultHandler( event:FaultEvent ):void
    // code for fault handling.

  • Using components in actionscript project

    Sorry if my question sounds dumb, but I just started learning
    AS3.
    I'm trying to use UI components in an ActionScript project.
    I can't import the definition of mx.controls classes such as
    Button or CheckBox.
    Here's the code I'm using:
    package {
    import mx.controls.Button;
    public class Learning {
    public function Learning() {
    var button:Button = new Button();
    When I compile, this is what I get: "Definition
    mx.controls:Button could not be found."
    How to import these definitions?
    -S

    Tried compiling it using the FlexBuilder IDE? There's nothing
    wrong with your code, so it sounds like your compiler doesn't know
    where to find the libraries, or is looking in the wrong place. Are
    you giving an explicit library-path argument?
    http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001500.html

  • Charting components for actionscript project

    hi -
    I have an actionscript project going (ie, not flex) and I want to use some kind of charting components
    I'm complining as desktop appilication, ie, I am running on the AIR platform
    because it's an actionscript-only project I dont think I can use any of the mx.* classes -- is this true? would be good to confirm that
    given that, I think my only option is to find a third-part charting package that's AS3-only
    any suggestions?
    thanks

    Tried compiling it using the FlexBuilder IDE? There's nothing
    wrong with your code, so it sounds like your compiler doesn't know
    where to find the libraries, or is looking in the wrong place. Are
    you giving an explicit library-path argument?
    http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=L iveDocs_Parts&file=00001500.html

  • 4.7 actionscript project with two .as files

    hi,
    Using FB 4.7 to make actionscript project with two .as file: Main.as and GFX.as. There are variable in GFX that Main cannot access. WHat do I need to do to the GFX.as file to make the variables it declares readable by Main.as?
    Thanks
    GReg

    Reason 1:
    put public before var . Example: public var foo:Number
    Reason 2:
    the variable that you can't load in Main.as should be inside function GFX() body. Example:
    package {
         import flash.display.MovieClip
         public class GFX
              public function GFX()
                   public var foo:Number  // Put your variables here that can be load by another class
              function anotherFunction(parameters:Number) // Another function starts here
                   foo = parameters
    Reason 3:
    In Main.as, put import GFX after package {

  • Actionscript project and Scout

    As I understand in order to use Telemetry I have to work with an ActionScript project. But how would I add UI components to this project? Or if I use Loader to load another SWF (with all UIs) will I be able to use Scout to it full power trouble shooting UI problems?
    Thanks

    You only need to enable Telemetry on the main SWF, not on every SWF you load.
    If you have a non-ActionScript project (like Flex), or an existing SWF, or you don't use Flash Builder, then you can enable telemetry on it with this simple tool:
    http://renaun.com/blog/2012/12/enable-advanced-telemetry-on-flex-or-old-swfs-with-swf-scou nt-enabler/

  • Mx.collections.ArrayCollection and others in ActionScript project?

    Creating an ActionScript project doesn't seem to allow access to the mx.collections (among many other) packages.
    What gives?  Is there some way to gain visibility to the those libraries?
    Thanks,
    Colin

    answering my own question: 
    check out: http://livedocs.adobe.com/flex/3/html/help.html?content=projects_6.html
    or: http://www.actionscript.org/forums/showthread.php3?t=125777

  • ActionScript Project - Export classes in frame 2?

    I have a holder swf that loads in a swf that has its own built in preloader. Problem is those preloaders are not seen. The loaded swf only displays after it is 100% complete. On its own, the swf with preloader works fine.
    I created the preloader by using the Frame metadata tag:
    (import classes etc.)
    [SWF(frameRate=60, width=900, height=580, backgroundColor='#2A3146')]
    [Frame(factoryClass="screens.Preloader")]
    public class MainClass extends Sprite
    Then in the Preloader class when all is loaded:
            private function onLoaded():void
             this.nextFrame();
             var mainClass:Class = Class(getDefinitionByName("MainClass"));
             if(mainClass)
                 app = new mainClass();
                 addChild(app as DisplayObject);
                app.start();
    In the holder swf it does something like this to load the swf:
                gameLoader = new Loader();
                gameLoader.load(new URLRequest(gamepath));
                gameLoader.contentLoaderInfo.addEventListener(Event.INIT, onGameLoadStart);
                gameLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
            private function onGameLoadStart(e:Event):void
                preloader = gameLoader.content;
                addChildAt(preloader,0);
    I thought this was the to do a "export classes in frame 2" kind of thing in an actionscript project, and it works great on its own but not when loaded inside another swf. Is there something I'm missing?
    I know I could just built a preloader in the holder swf, but the holder swf is loading in games that all have a unique style on thier own and the games' preloaders all dipict its games style.
    Thanks.

    You were right. It was the Loader not having the size. After your post I checked the to see if the server was serving with the right mimetype and with no g-zip compression. Everything was in in correct order. Then I checked from my connection at home and everything is loading as intended. Come t find out its something with our firewall. When checking from work and the swfs are on a server outside our firewall the total bytes are unknown. If they are on a server within our firewall they are fine. (Most problematic in Webkit browsers). So I guess i was going about it the right way. Thanks for your help.

  • Pure ActionScript project for Adobe AIR

    I've probably missed an obvious button or checkbox somewhere?
    I've seen that when you create a new MXML project, you have
    the option to target it at AIR. How do you do this for a pure
    ActionScript project? (Or import an existing pure ActionScript
    project that was written for AIR?)

    Hi Mister Lafrance,
    But, but it is same problem with creating project after build configure mxml to as. It can to show error - i have tried anything. It can not work while java runtime kills or show a lot of errors. Like this
    Error: ...
    at ...
    at...
    Please make sure my post!!! Sorry we must to configure manuel with RUN/Debug and adding as files....
    Thanks!
    Great nice tutorial! I hope because air developer are happy with Adobe Air Applications.
    Suggestions:
    new functions for executing applications like this flash.system.os.exec or flash.system.exec - If you want to build distributable Air Multi Applications.
    Application Air should to make default directory for important distributing air installers. If you want to work 1 or more application in currect directory.
    Like this:
    /mycompany <- that is root directory was created by frist air installer.
    ./airapps - that new distributing air installer while you after start of air application
    .//airapps/utilities/ <- example Air SDK should to copy into.. or nice air application like this Languagechooser or StyleChooser etc..
    ./airapps/softwares <- your built application like Widget Builder, Splashup or IconGenerater etc..
    ./airapps/config/ <- your currect saved config files. Important: all applications of distributing air applications will to load your currect config like Styles and Languages...
    ./myapp Binary <- create by air installer.
    ./shared/ <- assets,. libraries, templates and more files were created by Air installer.
    Can you make sure for my idea of distributing air applications? We would to talk with new file for Air distributuing packages = *.airdp.
    Thanks and best regards, SnakeMedia

  • Create new ActionScript project... how can I set a null SDK to something useful?

    Hi,
    I'm trying to create a new ActionScript project in Flash Builder... Simple, you say, "File - New ActionScript Project".
    Right.
    But when I do that, I get:
    And that then gives this:
    So...
    Obviously, I have something that is badly misconfigured somewhere. Hopefully something _REALLY_SIMPLE_ but I don't know what it is!
    Anybody?
    Please?
    G

    This may have something to do with it, but does anyone know how to set that value?
    G

  • Using external libraries with Actionscript Project

    Hi,
    I've hit a bit of a brick wall trying to do something that I figured would be a relatively simple task. I'm working on multiple projects and I'm trying to build a number of SWC libraries shared between a number of Actionscript projects using Flash Builder 4. The projects using the SWC's build just fine, but yield this error when run:
    VerifyError: Error #1014: Class <whatever> could not be found.
    Here's a simple example:
    1) Create a new library project.
    2) Add a new Actionscript file in the "testpackage" package.
    3) Slap this code into that file:
    package testpackage
        public class stuff
            public function Testing():void
                trace("Oh yeah!");
    4) Create a new Actionscript Project named Launcher
    5) In "Properties->Actionscript Build Path", hit "Add SWC Folder" and browse to wherever the library project gets built to.
    6) In the AS file that's generated, add code something like:
    package
        import flash.display.Sprite;
        import testpackage.*;
        public class Launcher extends Sprite
            public function Launcher()
                var s:stuff = new stuff();
                s.Testing();
    7) Run this bad boy.
    I get the above error and I have no idea why. Everything builds fine so I'm not sure what I'm doing wrong. I read somewhere that you can manually extract the .swf file from the generated .swc and load that explicitely in code. This is a pretty horrible workflow and I hope it's not the answer
    Thanks a ton in advance!
    -D

    Check  linkage type in Build Path for project Launcher when you add Swc folder. It has to be merged into code.
    If it is external, you'll see this error.
    That aside, why not do "add project" instead of "add swc folder"?
    -Anirudh

  • Actionscript Projects

    Every example I can find of building an Actionscript Project
    uses the default or root package. I can make those examples work,
    and I can create my own examples that work that way.
    Can someone please show me the sequence of setup operations
    to get an Actionscript Project to work when the code is NOT in the
    default package?
    If there is a correct way to fill in the options with the
    create wizard, great, but if it has to be done by manually creating
    some directory structure, that's fine, too. I will be happy with
    any method of setting up, building and running a simple trace
    ("Hello World") with the HW Class being in some package hierarchy.
    Thank you.

    Hello Rick,
    Go to Flex Builder and select File > New > ActionScript
    project
    Give the project a name and point to the folder where your
    ActionScript source is located.
    Once the project is created, right click on the project in
    the Navigator, and select Properties.
    In the ActionScript Applications section, Remove the default
    AS file created by Flex and Add the main file of the project.
    Click OK.
    You should now be able to build the ActionScript project.

  • Use mx and spark components in pure ActionScript project?

    I'm working on an AIR project in Flash Builder 4, but I'm not using MXML at all (pure ActionScript). Is there a way for me to instantiate and use mx and spark components without MXML? If not, what is the minimal amount of MXML I have to use? FYI, I've already tried all of the following hacks with absolutely no luck:
    http://www.actionscript.org/forums/showthread.php3?t=143062
    http://ersatz.tv/2009/off-topic-flex-components-without-mxml
    http://stackoverflow.com/questions/141288/possible-to-use-flex-framework-components-withou t-using-mxml
    I much prefer ActionScript over MXML. Why does Adobe have such a hard-on for this MXML ****?! It's like all that code and all those great components are going to waste.

    Me too.. . I'm a pure as3 guy and all these components go to waste. You would think they would allow people to generate components via mxml or as3...

  • Embed OTF Font as CFF in Pure Actionscript Project using Flex SDK 4.0

    I want to apply the method explained here: http://www.insideria.com/2009/03/flash-text-engine.html using only the Flex SDK 4 (not using FlashBuilder)
    Specifically:
    Embedding fonts can be tricky. In Flex, embed the font and store it
    using DefineFont4 and font subsetting currently only supported by Gumbo.
    A future version of Flash will support it but in the meantime, a Gumbo
    SWC with the embedded font must be created then adding to your Flash CS4
    project.
    The following is the method I am using to embed the fonts.
    public class Main extends Sprite {
         [Embed(source="../assets/GE Thameen DemiBold.otf",
                                  fontFamily = "GE Thameen",
                                  fontWeight = "bold",
                                  mimeType = "application/x-font",
                                  embedAsCFF = "true"
         private const GEThameen:Class;
    The following command line was assimilated after solving the output error messages using google and a little looking into how FlashDevelop works..
    mxmlc Main.as -load-config config.xml -managers flash.fonts.AFEFontManager
    The output SWF is not working as supposed, and the file size (20KB) does not seem to account for the embedded font. PS: When the font embedding is bypassed, and a device font is used for the text engine classes, the file works perfectly.
    The contents of config.xml are as the following:
    <?xml version="1.0" encoding="utf-8"?>
    <!--This Adobe Flex compiler configuration file was generated by a tool.-->
    <!--Any modifications you make may be lost.-->
    <flex-config>
      <target-player>10.0.0</target-player>
      <compiler>
        <source-path append="true">
          <path-element>E:\actionscript</path-element>
        </source-path>
        <external-library-path>
            <path-element>C:\bin\flex_sdk_4\frameworks\libs\player\10.0\playerglobal.swc</path-element>
            <path-element>C:\bin\flex_sdk_4\frameworks\libs\flex.swc</path-element>
        </external-library-path>
      </compiler>
      <file-specs>
      </file-specs>
      <default-background-color>#FFFFFF</default-background-color>
      <default-frame-rate>30</default-frame-rate>
      <default-size>
        <width>800</width>
        <height>600</height>
      </default-size>
    </flex-config>

    After losing about 2-3 days to trying to figure this stuff out, I rolled back to build 4.5.0.19786 and the problem doesn't occur anymore.  I'll revisit this issue once we ship the product next week.
    Thanks Alex.
    Cheers,
    Nate Beck

Maybe you are looking for

  • Gmail in mac book pro frozen on podcast rss download, Gmail in mac book pro frozen on podcast rss download affecting entire computer

    Okay, so I am NOT the most tech-savvy girl so please excuse me if I'm sounding really stupid... I have a mac book pro (2 years old). I like to download podcasts on my iphone and I guess they then sync via iTunes cos they appear on my mac book pro as

  • 3rd gen 40g dock connector touchwheel with 4 buttons above wheel

    i have old 3rd gen 40g dock connector touchwheel with 4 buttons above wheel. does not have firewire port on top , just hold switch and funky headphone jack for wired remote control . battery has long since died but still runs fine off wall current ch

  • DVD Drive on Refurbed 1.3 Gig G4

    The DVD drive on the machine I recieved today will not mount DVD's. It is telling me that the copy of 10.4 that I purchased is a blank DVD. I tried the DVD on a different machine, and it is not blank. It is telling me that my application DVD's aren't

  • Ssh -X solaris 9 host fails to set DISPLAY

    i'm running Suse 9.1 Pro as my graphis client. x86 doesn't quite work yet on my host. i'm trying to run smc from my E250 (headless) to my Suse 9.1 desktop. the E250 is running Solaris 9. when i ssh -X and echo $DISPLAY, DISPLAY is empty. howerver, i

  • Help with downloading podca

    Can I somehow get itunes podcasts on my Zen? Is there a way to transfer or convert the file to get it from itunes to my player. I have also tried using Juice software and subscribed to this particular podcast, but its not recognized by my Zen softwar