Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

returning data which can access AS function

Avatar

Avatar
Level 1
ccrum
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
ccrum
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
ccrum
Level 1

19-06-2008

I migrating from an HTML/Flash app previously built to an all
FLEX app. The previous app ran a db query through AJAX to an ASP
script and returned the results (basically a list of names) as a
series of forms (each name was essentially it's own form), which,
when clicked on, fired some javascript to do some other actions. A
single result looked like this:



<form style="margin: 0;" target="_blank" id="frm117"
action="
http://www.wispmon.com/gis/getcust.pl"
method="POST"><input type="hidden" name="CustomerID"
value="117" /><input type="hidden" name="WispID" value="
10001 " /><a href="javascript:void(0);"
onclick="link(frm117)"><font color="#FF0000">Monty
Smith</font></a>



The javascript function "link()" basically just submitted the
form to the cgi script.



I have the FLEX app calling the same ASP script and
returning the same results to a TextArea, but what I want is
instead of the results being a form and firing the javascript, I
want it to be a flex text field and have them fire some AS Function
which will perform the same action as my "old" app. I guess the
question is, can I build FLEX controls on the fly?

Replies

Avatar

Avatar
Level 2
SujitG
Level 2

Likes

0 likes

Total Posts

39 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
SujitG
Level 2

Likes

0 likes

Total Posts

39 posts

Correct Reply

0 solutions
View profile
SujitG
Level 2

02-07-2008

Hi,



You can definitely create Flex controls during run time. All
you have to do is to instantiate the component and add it to
container. I created a very simple sample code which adds a
TextArea at runtime. Please find the sample code attached.



Hope this helps.



Code:



<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical">



<mx:Script>

<![CDATA[

import mx.controls.TextArea;

private function addTextArea():void

{

var txt:TextArea = new TextArea();

txt.text = "Hi this is added at run time";

this.addChild(txt);

}

]]>

</mx:Script>



<mx:Button label="Add text area"
click="addTextArea()"/>

</mx:Application>