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

Similar Messages

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

  • 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

  • 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

  • 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

  • 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/

  • [svn:fx-trunk] 15267: Cannot set Spark Label or Spark RichText showTruncationTip property at runtime using bindngs or ActionScript .

    Revision: 15267
    Revision: 15267
    Author:   [email protected]
    Date:     2010-04-07 15:57:04 -0700 (Wed, 07 Apr 2010)
    Log Message:
    Cannot set Spark Label or Spark RichText showTruncationTip property at runtime using bindngs or ActionScript.
    QE notes:
    Doc notes: None
    Bugs: partial fix for SDK-25980
    Reviewed By: Gordon
    Tests run: checkintests
    Fix Label styles baselineShift and typographicCase so they work as documented.  The documentation is from TLF.
    QE notes:
    Doc notes: None
    Bugs: partial fix for SDK-25169, SDK-25210
    Reviewed By: Gordon
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-25980
        http://bugs.adobe.com/jira/browse/SDK-25169
        http://bugs.adobe.com/jira/browse/SDK-25210
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Label.as

    I'd have to see the xml to say what, but 1009 is what it says - a null reference has no properties, it is null.
    Try tracing out SampleWebServiceCS.GetMember and you'll quickly see where along your .element.element path you have an error.
    (BTW, I've not used s:Operation before, but is your syntax correct?)
    G

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

  • Converting MXML Components to ActionScript Classes

    I'm in the process of converting most (if not all) of my MXML
    components to Action Script classes. I've found this is easy, and
    doesn't require a lot of extra code when extending a simple
    container or control. However, several of my MXML components have
    several nested containers and controls - i.e. a component that
    contains several Labels, a ComboBox, a TextInput, a Button, and a
    DataGrid, plus several other containers needed for layout. To code
    the layout of all these containers and controls using MXML, it uses
    about 16 lines of code. To code the layout in ActionScript, it
    takes about 50+ lines of code (see attached).
    I'm just wondering if there are any best practices for
    creating ActionScript classes that include several (or even A LOT
    OF) containers and controls. It's very easy to layout in MXML, and
    is more visibly pleasing to look at and understand, but I feel it
    is best practice to code components as ActionScript classes. I know
    I should be using MVC, but it's a little late to rewrite the entire
    application now.
    Any thoughts?

    I can't specifically speak to how to write layout code in
    ActionScript, but you can look at the generated code that Flex
    creates to get an idea of how Flex does it. When you compile an
    app, the Flex compiler takes your MXML input and converts it to
    ActionScript classes before compiling the entire set of classes
    into a SWF. Because of this, you can look at the interim
    ActionScript code.
    You do this by setting the keep-generated-actionscript
    compiler option to true and looking in the /generated directory.
    hth,
    matt horn
    flex docs

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

  • 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;

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

  • How can I use LCCS with ActionScript 3 and Flash CS4?

    Hi,
    Using Stratus I was able to create an an application using Action Script 3 and Flash CS4.  The sample code on the Adobe site was quite straight forward and easy to understand.  I now want to switch over to  LCCS but can't find anything any where on how to use Action Script 3 and Flash CS4 with LCCS.  Do I need to know Flex to be able to use LCCS?  Everything was quite simple and easy to understand with Stratus and makes complete sense.  But LCCS is really confusing.  Is there any sample code on how to establish a connection in Action Script 3 and then stream from a webcam to a client.  There is nothing in the  LCCS SDK that covers Flash and Action Script 3.  Please help!  I found the link below on some forum but it takes me nowhere.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=75 9&threadid=1407833&enterthread=y

    Thanks Arun!
    Date: Thu, 29 Apr 2010 11:44:10 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I use LCCS with ActionScript 3 and Flash CS4?
    Hi,
    Welcome to the LCCS world.
    Please refer to the SDK's sampleApps folder. There would be an app called FlashUserList. The app demonstrates how LCCS can be used with Flash CS4. Its a  pretty basic app, but should help you moving.
    We are trying to improve our efforts to help developers in understanding our samples. Please do let us know if we can add something that would help others.
    Thanks
    Arun
    >

  • How to use settingsfilegenerator in c# project which is part of biztalk solution

    As part of expression shape in the orchestration, I am calling a c# method by providing input parameters.
    MyCompanyName.Integration.MyProjectName.Project.ListsProxy.SubmitFilesToDropOffLibrary
    (XmlInputMessage,
    MyCompanyName.Services.ConfigStore.SSOClientHelper.Read("ProjectName", "InboundTransportLocationAddress"),
    InputMessage.SelectRecord.DOC_IDENTIFIER + "*");
    One of the parameters "MyCompany.Services.ConfigStore.SSOClientHelper.Read("MyProjectName", "InboundTransportLocationAddress")"
    is looking into the settingsfilegenerator and taking in the right values.
    However,it's not picking when used as part of c# project.
    As part of the method in the c# project, I have a string hardcoded with url.
    string x = "http://.....";
    the url need to change for every environment of deployement. So I want to change the hardcoded url to picked up from the
    settingsfilegenerator.
    So in the settingsfilegenerator, I  have added
    <Row>
            <Cell ss:StyleID="s77">
              <DataSubmitFileEndpoint ss:Type="String">GetTaxonomy</DataSubmitFileEndpoint>
            </Cell>
            <Cell ss:StyleID="s78">
              <Data ss:Type="String">http://.......asmxx</Data>
            </Cell>
            <Cell ss:StyleID="s78">
              <Data ss:Type="String">http://........</Data>
            </Cell>
            <Cell ss:StyleID="s78">
              <Data ss:Type="String">http://........</Data>
            </Cell>
            <Cell ss:StyleID="s78">
              <Data ss:Type="String">http://........</Data>
            </Cell>
            <Cell ss:StyleID="s78">
              <Data ss:Type="String">http://........</Data>
            </Cell>
          </Row>
    string x = MyCompanyName.Services.ConfigStore.SSOClientHelper.Read("MyProjectName", "GetTaxonomy");
    But it's not picking up from the settingsfilegenerator. It's working when used as part of orchestration but not when used in the c# project. I have added
    the reference for config store in both. But not working in c# project.Could anyone help please

    It's working when used as part of orchestration but not when used in the c# project. This is very confused. :(
    you could check whether give a reference properly first.

Maybe you are looking for

  • 2 ipods on one laptop....help

    Well I returned my shuffle for another like customer support said. In my second ipod. Almost got it working. Here is my question. My son uses an ipod mini on his laptop. I'm trying to get my shufflr working on it too. Now I get the message can't writ

  • No Magnifier in Bridge CS5

    I'm running Win7 64 Ultimate. Another problem is that files occasionally open spontaneously as I am reviewing the shoot.

  • Can I Skip Ahead To Next Video In Menu?

    I've set up my menus, submenus and videos in iDVD, burned a trial disc and am happy with it, except for one thing. When a video is done, I get taken back to the menu every time. I'd like to be able to skip ahead to the next video in the menu, but ins

  • SD DVD made in DVD studio pro doesn't work- please help!

    Can't figure this problem out for the life of me - checked all forum posts available and nothing has helped. Hopefully you can help me solve this: I made a SD DVD on a DVD-R (Verbatim 16x) with DVDSP 4.2.1 and it wont work on most DVD players - but -

  • Sending Address Book cards to a Nextel i880

    I've got a Motorola Nextel i880 phone that I'm trying to send Address Book cards to. My Mac can see and connect to the phone over Bluetooth, but the phone doesn't seem to want to talk to my Mac. I've tried using iSync, but apparently Apple doesn't su