Draw a rectangle from a flex application

Hello

GRAND CHALLENGE (should be ' hello world ' everyone should easily find):

(1) - application flex with a button
(2) - when you click on the draw the rectangle button

WORK NO PROPOSED SOLUTION:

Draw.MXML:

"""
<? XML version = "1.0" encoding = "utf-8"? >
"" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "absolute" >
< mx:Script > import DrawApp; < / mx:Script >
< mx:Script >
<! [CDATA]
function drawNow (): void {}
var myRectangle:DrawApp = new DrawApp();
myCanvas.addChild (myRectangle.returnRectangle ());
}
[]] >
< / mx:Script >
< mx:Canvas width = "100%" height = "100%" id = "myCanvas" > < / mx:Canvas >
< mx:Button label = "draw" click = "drawNow ()" > < / mx:Button >
< / mx:Application >
"""
DrawApp.as:
"""
ActionScript file

package {}

import flash.display. *;

class DrawApp extends Sprite
{
public void DrawApp()
{
do not use the constructor more since it returns the rectangle
}
public function returnRectangle (): shape
{
var rectAndCircle:Shape = new Shape();
rectAndCircle.graphics.lineStyle (1);
rectAndCircle.graphics.beginFill(0x0000FF,1);
rectAndCircle.graphics.drawRect (125,0,550,575);
rectAndCircle.graphics.endFill ();
Return rectAndCircle;
}
} //class

} //package
"""
I got an error '1034' (BTW bonus if anyone knows how I can avoid having AS3 localized error messages so that I can paste in English full error messages)

CHALLENGE:
Can someone show me how to do this wok before Silverlight2 Beta come out?

Thanks to François who is crazy to try to solve this problem "should be obvious Hello World" for too long, and who also discovered recently:
-l' lack of discussions in AS3
-crazy security around Flash Player policy (must set up a proxy to access a public API...)
-etc.

Help please Oo

OK found the solution: you need to change the subject of 'Shape' by a 'UIComponent' object (don't know why).

Tags: Flex

Similar Questions

  • Recover data from the flex application

    Hello

    We use html data in Flex via Flashvars, I want to use the HTML flex application data, how can I do?

    I know we use javascript for it functions, but I need an example.

    Kindly help.
    Mandeep

    You can see this FB 2.0.1 topic help (or via LiveDocs on the web):
    Access Flex from JavaScript

    -------------------------- MXML ---------------------------


    http://www.Adobe.com/2006/mxml"creationComplete =" initApp () ">"

    flash.external import. *;

    public function initApp (): void {}
    ExternalInterface.addCallback("IsStatic",IsStatic) ("myFlexFunction", myFunc);
    }

    public void myFunc(s:String):void {}
    S = L1.text;
    }

    ------------------------------- HTML ----------------------------

    wrapper/AddCallbackWrapper.html

    AddCallback Wrapper


    Enter a new title:






    http://download.Macromedia.com/pub/Shockwave/cabs/Flash/Swflash.cab#version=9, 0,0,0' height = "200" width = "400" >


    http://www.Macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' height = 100% "width = 100% ' flashVars =" / > "

  • Call a html FLEX application, using parameters

    Hi guys,.

    I have this html code:

    "< form ="getTracing"method ="POST"name action ="http://syyzas400/ShipmentInquiry/ShipmentDetails.html"> ".

    QuickTrace

    < input type is "text" name = "TrackNbr" size is "14" tabindex = "1" maxlength = "11" >

    < br >

    Carrier

    < select name = "Carrier" tabindex = "2" style = "background-color: #D8E4FF;" color: black;

    do-family: Arial; make-weight: bold; do-size: 9pt; width = 114 ">

    < option > option 1

    < option > option 2

    < option > Option3

    < / select >

    As you can see, it has an input field ("TrackNbr") and a selection field (the ' carrier'), with three options... The user enters a number of follow-up.

    in the first field and choose one of the three options in the second field and hits < enter >. Now, as you can see on the 'action' box, an element html (part of a FLEX application) is called. The problem is that ('TrackNbr' and 'Carrier') parameters are not passed, and I don't know how to do this.

    This FLEX application accepts the parameters using the technique of URL fragments (because can be called from another FLEX application, too)

    but of course it does not work with the form described above.

    I read on the external Interface class, but everyone speaks to call ActionScript functions, not FLEX applications. Being a beginner in this area.

    I don't know that I'm missing something, but what?

    Any help would be much appreciated, as usual...

    Florin

    could try to use the GET method and parse the URL when loading the application

    var path:String;
    
    var URLpath:String = ExternalInterface.call("window.location.href.toString");
    var PassedData:Array = URLpath.split("?");
    
    var Parameteres:Array = PassedData[1].split("&");
    
  • A component AS does not appear in a flex application

    The following ACE draws a line and working full-time,

    package components {}

    import flash.display.Sprite;
    import flash.display.Shape;

    SerializableAttribute public class DrawTest1 extends Sprite {}

    public void DrawTest1() {}

    var shape: Shape = new Shape();
    shape.graphics.lineStyle (0, 0x0000FF, 1);
    shape.graphics.lineTo (100,100);
    addChild (shape);
    }
    }
    }

    It was then included in an application flex as

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml '
    xmlns:custom = "components.*".
    layout = "horizontal" >

    < custom: DrawTest1 / >

    < / mx:Application >

    but only a blank screen (i.e. without the line) displayed when the flex application has been executed (no error message was given when compiling). Help, please.

    Containers Flex (incluing Application) can only contain components that are derived from UIComponent or implement the IUIComponent interface.

    To get your component to be displayed in the application create a UIComponent as child and add the component of DrawTest1 as a child to it.


  • Draw a rectangle in a graph

    Hi, I want to programmatically draw a rectangle on a chart XY (XY Graph.vi Build). I know where the 4 points are on the coordinate chart but I can't yet draw using the block Rectangle to draw. Could you please help me how can I draw a rectangle in a graph. I am attaching the photo to this message

    Hi guys,.

    I thought it was interesting questions - and, although I had not tried anything quite like this before, I thought I would give it a whirl. smercurio_fcsuggestion was excellent - I find the code referenced in LV example finder, in the fundermentals > graphics & graphics > plot pictures folder.

    Attached are 2 pieces of code.

    DrawRectangle on Graph.vi allows users to define the rectangle by cluster of façade.

    DrawRectangle on graphic .vi (events) allows the user to define the rectangle by clicking and dragging on the chart. Please note that the code requires that you start from the upper left corner of the rectangle, and drag to the lower right. But isn't that a creative logic would not solve - if you wanted a bit more flexible code.

    You should also know that I have not spent a lot of time on the code, so it is not perfectly architected. But we need to think!

    Best wishes

  • Draw the rectangle to the intensity chart (position where clicked)

    I am able to extract the coordinates using the mouse down and mouse to the top of the structure of the event, but unable to draw the rectangle at the specified position. I get the coordinates to the mouse down and mouse up to the event within these limits. I want to draw a rectangle in the position coordinates, but unable to do so.

    One last thing, since you use the Rectangle to draw, you need to deal with cases where the rectangle is not drawn from top left to bottom right. Please make sure that the minimum value X goes to the entrance on the LEFT and the minimum value of go at the TOP of the terminal of the vi entrance Rectangle rect. Use the Max & Min function from the palette of comparison for that.

    Ben64

  • How to draw a rectangle with a border change according to a border image?

    Hi, I already walk image on a photo. Now I want to draw a rectangle at the end of the walk, but the border of the rectangle and border on foot to meet another eact perfectly.

    example image I gave below (downloaded from the internet). I want to fix this rectangle at the end of the foot.

    Thanks in advance

    https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQRMYcCcxX5sC9jv8AUS64LSfb8I7K6GSsKCsCrUCOE1tbQ6f-Phttps://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRSj_yAwQWXik-xB-spAi9gZwUSgz6JkPCgpGmdajCrY0h6P0hGnw

    Nice day!

    Could you please post a screenshot with the Panel visible layers?

    Is the iten by chance one layer shape and therefore does not have a vector mask?

    Kind regards

    Pfaffenbichler

  • Flex application and several basic material

    Hello

    my company is developing an enterprise application pretty huge involving 4 Flex, BlazeDS, a server side Java-spring and frame matte on the client side.

    It works very well but as demand is growing bigger and bigger performance problems are a major concern for us... And our customers!

    We just noticed a performance problem and I could not find any resource from Google, it's here:

    It seems to us that no matter what the number of CPUS of your computer has, our Flex application always use only one. Accordingly, our application rolls over on a P4 core at 3 GHz computr processor than, say, on a core i7 with 8-processor 1, 6 GHz! Pretty strange isn't it?

    However, I learned that multicore of handfuls of Flash Player since version 9, so perhaps am I missing something simple? Is there something I should do to enable multicore processing? What is my application which is poorly designed? Or an operating system issue maybe?

    Any help would be greatly appreciated

    Thank you

    Matt

    ActionScript is single-threaded, so there is no advantage to try to spread his treatment between multiple cores.  Once the actionscript code has implemented the displaylist for a framework, certain aspects of the rendering of the display list can be distributed to the other cores or even a gpu.  Use the performance profiler to see where you as usage patterns are expensive and optimize.

  • Save the Flex application as a service

    Hello

    Is it possible to save Flex applications as services? And by here I mean--taking the example of Android - the app is closed, but still running in the background (not visible in the Task Manager).

    The reason why I ask, is that if for example I want to have notifications in real time, of events at certain times or things of the location function, I need the application to be "aware" all the time but taking place as few resources as possible.

    Also, it would have been nice setting to start at system startup and so on.

    Thank you.

    Well, he gives examples of what you can do with this thing, but you can do much more... On a native android app, you start a service at the launch of the system in the background to check what you want to check.

    In this example, we start a service when we start to demand... You can change to start the service at the launch of the system and start the main activity (to launch your swf) from the service!

  • FileReference - crossdomain.xml - restrict access to all MY Flex application?

    I have a Flex application based on the web (domain A) concerning must download files on the desktop of the user FROM an external server (domain B). I use Adobe FileReference class to do this. Now, I know that I need a file crossdomain.xml to the external server in domain B to establish trust between the Flex application and the server download. In the end, I need any user to any domain to have access on the server download for the cross-domain file must specify:

    allow-access-from domain="*"

    But this will open up acess to the downloadble files to any flex app out there on the web . Is there a way to restrict access to just MY Flex app in the
    crossdomain.xml file?

    thx in advance!

    -MC

    Why do you need any user to any domain access?

    Anyone using your web application will be in area a. unless you count should the swf for others to download from their servers (which woiuld be strange)

    the field is the place where its hosted

  • In Flex application feature sometimes works and sometimes does not...

    Hello

    Please help me on this...

    In my flex application features works sometimes and doesn't work sometimes does not...

    In my project, I have 5 sections with 5 separate screens... Each screen is a module of different.

    After logining in the application:

    I'll go to a screen... First time each feature works in this form...

    Ex: I have a screen with datagrid. This user select name from a datagrid job click on the next button...

    According to the name of the selected user work, I display information on the next screen and customer names.customer whose name is a drop-down list box.

    Here is the code:

    public void populateAllOEMCustomers(event:ResultEvent):void
    {

    1) var object_CustomerList:CustomerList = event.result as CustomerList; the values of the object //Assigining the object reference variable result.

    (2) var allOEMCustomersCollection:ArrayCollection = new ArrayCollection(); Variable declaration ArrayColliction referance.

    (3) var i: int = 0;
    (4) var customerComboLabel:Label = new Sun;

    (5) for (i = 0; i < object_CustomerList.arryCollCustName.length; i ++)
    {
    var strCustName:String = object_CustomerList.arryCollCustName.getItemAt (i) m:System.NET.SocketAddress.ToString ();
    var strCustId:String = object_CustomerList.arryCollCustId.getItemAt (i) m:System.NET.SocketAddress.ToString ();

    customerComboLabel = new Sun; Dynamic Declaration of the label.

    customerComboLabel.name = strCustName; Assinging the customer name in the label name box.
    customerComboLabel.text = strCustId; Assingning the customer id in the text box on the Label.

    allOEMCustomersCollection.addItem (customerComboLabel); Addition of Lable in the referace ArrayCollection variable collection.
    }
    customerComboID.selectedItem = ' - ';.
    OEMCustomersComboID.dataProvider = allOEMCustomersCollection;
    OEMCustomersComboID.selectedItem = - 1;

    }

    This feature works very well when I visit the first time on the screen... If you go back to another screen and return to the same screen and click the button following this names combo box customer time has no customer Details... I get Nullpointer Exception and it shows the number of the line 5 (I gave the above code number..)

    If I change the first line of the code to the following: each time the feature above works fine. Not getting no not an error msg...

    var object_CustomerList:Object = event.result;

    If I type cast in specific class (CustomerList), the feature does not work... do null pointer exception... If I type cast to object everything works fine... In my code each time I'm typecasted for the features of the specific class is not working (gettingNullpointerExcepion).

    Please help me on this... I don't get what could be the reason...

    I am using::Flex 3, Flash player 10.1

    Thanks in advance...

    Kind regards

    Satya

    Hi Satya,

    This sometimes as in your case may not work the way you have specified the RemoteClass attribute in your AS class. Because sometimes there may be a case because before it is mapped to a server-side, you are returned to the data and so that you can not get your custom class data but as normal object type.

    So to avoid this, you can map the class server-side for as classes in the Manager PreInitialize itself as shown below:

    Specify the preinitializeHandler in your main application and write the function below. That way, too, you can map as classes on the side server. So you will have no problem referring to your application AS class types.

    You can use the same line for recording of all classes. Using this, you can remove all of the [RemoteClass] attributes on all CLASSES and attach it to the unique place.

    preinitialize = "onPreinitialize ()" "

    private function onPreinitialize (): void
    {
    registerClassAlias ("com.expeditor.ScriptAdmin.Objects.CustomerList", list of clients);
    }

    In the line above the quoted string code refer to the namespace of the class on the server side and the second is your AS class. Also, remember to import the namespace from the correspondent as a class in the file.

    Try this and let me know...

    Thank you

    Jean Claude

  • Rendering problem - all the text in my Flex application is not visible, but only for a single user

    Hi all

    I have a very strange problem... we had a trouble report from a user who said that she could not see the text in a Flex application, we are working on.  It works for everyone but this one user - and still unknown, it works for me when I open as the user, on the same hardware that is using this user.

    The only difference is the remote desktop client that is used.  In my test case, I connect to the Terminal Services Server in Windows 2003 server from my workstation, and it works.  It connects on the same Services Terminal Server in Windows 2003 workstation server, using the same credentials, and it does not work.  If I don't see it with my own eyes, I'm not sure I would have believed it.

    To prove that I'm not crazy, I made a record.  Check it out:

    http://screencast.com/t/OWE0YWMzMz

    What's happening in the world!

    -Josh

    Wmode causes a lot of weird problems.  Avoid at all costs.

  • The term PUSH in Flex Applications

    Hello

    While browsing the FLEX tutorials, I read that we can implement Push in Flex Applications
    With the HELP of Blaze ds, or all other servers.

    can someone please let me know what is meant by the term Push?

    Thanks in advance.

    That means pushing data from the server to a Flex client.

    For example, what happens in a chat application. A person sends a message to the server, and it is pushed to all clients connected to this chat room.

    A word of caution when it comes to 'push' and Adobe products. Displays LCD grows properly, not BlazeDS. He says he does, but is really just polling.

  • Integration of Flex applications within a matter of portlet

    I have a simple Flex app embedded in a JSR portlet (168) on a Weblogic Portal 10.3.2 server. I would like to know how to set up the portlet to listen to events fired from the embedded Flex application. Is anyone aware of any doc that deal with these?

    Thank you

    the day ndo portlet is always rendered as html, so it always comes down to the same thing.

  • Multiple Flex applications on a single Page

    Now that I was laid off from Adobe (with 700 other people), I would ask you Flex consulting opportunities, and one of the possibilities are web designers/developers wishing to offer their customers a value-added components.

    My question is I've heard you don't want for example three separate applications to Flex on a single web page, as it results in three instances of the generated Flash Player, or something like that.

    So is it necessary to group multiple Flex components in a Flex application to each web page? This may limit the placement of Flex components on a web page, because the web page will be completely done in Flex, that the page should be available.

    No indication in this regard, especially Alex and others on Adobe's Flex product team.

    All new Flex needs help on Flex components/applications, I am available: [email protected]

    Thank you!

    Greg

    IMHO, it's all about memory.  Many pages have several flash banner ads running drives.  This is because these ads are small.  If you go to paste a few applications really small flex on a page, I would expect that most people have enough computer resources to manage it.  Once you get more complex, your apps also probably face more screen real estate and soon you are looking for a portal and probably should have a main shell that loads of apps.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

Maybe you are looking for

  • Why iMac has suddenly started asking to sleep after password?

    Hello I have my standard account set to auto connect. But for some reason any iMac has recently begun asking password after walking computer from sleep mode. Why is this?

  • Cannot be used on Qosmio G30 recovery CD

    Hello I'm doing a recovery on my G30 and have recovery G30 dvd but when I insert the disc all get them is a message saying - this recovery and applications cd is not configured to work with this machine (laptop). This cd is for: Qosmio G30... Please

  • Satellite M30X: Question on Config-free 4.90.57

    HelloI am the owner of a Satellite M30X, and I wanted to format and reinstall windows xp sp2... I collected the information for this... and I read in a pdf document information update of Windows XP SP2 that I should update the Config Free 4.90.57 but

  • Strange problem with Satellite 2450-201 keyboard

    I have a Toshiba Satellite 2450 201 when I'm working with one of the applications of the evil Offcie I load keyboard keys '4' or '6' or in the 'space bar', it seems to me soon the window "save under...". "and I don't get close. What is pass?José Edua

  • use data tpye I64 in labview 7.1

    Hello I update a former program and must use data tpye i64 in labview 7.1, but only support labview 7.1 i32. So how to use i64 in labview 7.1, thanks for your help. Sonic