Newbie: binding actionscript var to textinput

Hi,
I'm just starting with flex, and have a simple question on
bindings. I've created the following application (using flex3 beta
3, and flexbuilder):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
[Bindable]
public var customerName:String = "customerName";
]]>
</mx:Script>
<mx:TextInput text="{customerName}" x="187" y="92"/>
<mx:Text text="{customerName}" x="368" y="94"/>
<mx:Button click="customerName += 'z'" x="473" y="92"
label="add z"/>
</mx:Application>
The problem: the variable customerName isn't changed when i
enter some text in the textinput. Pressing the button does the
expected thing: changes the variable, which is displayed correctly
by the textinput and text components.
My goal is to create a datamodel using an actionscript
object. I've seen some examples where the datamodel is bound to the
textinput (the other way around), but it seems to me that it would
be better not to tie a datamodel to one single input component. I
may want to modify the data using multiple components.
Thanks,
Andrej

My 2 cents: There is often a misconception that when making a
variable bindable, it is a two-way binding, in other words, the
entity that is bound to the variable will be updated automatically
AND the variable will be updated if the entity's value changes (a
circular binding).
Making your variable [Bindable] means that there is a single
observer, like your TextInput, of a variable, like customerName. If
the customerName variable changes, then the TI will change, not the
other way around.
Your approach of using the Binding tag with a reciprocal
source and destination should be fine.
My approach usually is to set the initial value I want
displayed in the TI from elsewhere. Then the TI is strictly used as
the control to input data in order to update a variable on the
'change' event. I often bind to a function that'll automatically
perform XYZ for me on a specific event.
TS

Similar Messages

  • Binding ActionScript object to webservice

    Hi,
    Can someone please provide me with simple example as to how
    to bind an ActionScript object to the webservice.
    The Scenario is I have an actionscript class. I have the
    webservice in the mail mxml. I want to create an object of the
    class and want to bind that object to the webservice rather than
    binding each of the property.
    Thanks in advance.

    Do not bind directly to a webService result. Use a result
    handler, and assign the result to a bindable variable. Bind to
    that.
    To intercept binding events in AS code, use a ChangeWatcher.
    Tracy

  • Can't dynamically bind Request var to ViewObjectLink SQL (for BIBean Graph)

    Can anybody pleaaaase help? I'm trying to get a graph done with JSP and a BI Bean. I have got the graph working just fine, based on an unfiltered query of the ViewObjectLink. However, have not been able to figure out how to dynamically add and alter the criteria of the underlying ViewObjectLink query.
    My research has found numerous references to the setWhereClause() and setWhereClauseParam() functions. I've placed setWhereClause() and setWhereClauseParam() calls in the constructor of the ViewObjectLink. But I always get exceptions :
    JBO-30003: The application pool (test_16.AppModuleLocal) failed to checkout an application module due to the following exception:
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=
    JBO-29000: Unexpected exception caught:
    oracle.jbo.InvalidObjAccessException, msg=
    JBO-25036: An invalid object operation was invoked on type View Object with name FaVGetDueDatePcCtab2ViewImpl_120
    Any and all help appreciated.
    Thanks in advance,
    John.

    Thanks Keith.
    It's a question of how one sets and accesses the query datasource of the ViewObject which underlies and populates a BIBeans graph.
    I don't see how one binds criteria value(s) to the parameter placeholder(s) in the ViewObject object.
    For example, the Query property of my ViewObject is:
    SELECT FaVGetDueDatePcCtab2.PC0,
    FaVGetDueDatePcCtab2.PC1,
    FaVGetDueDatePcCtab2.PC2
    FROM FA$V$GET$DUE$DATE$PC$CTAB2 FaVGetDueDatePcCtab2
    The Where Clause propery is:
    WHERE FaVGetDueDatePcCtab2.PC2 IN (?, ?, ?)
    What wizard or method or means is used to bind the '?' placeholders with actual values?
    Or do you think this is more a question for the Forms/Reports forum?

  • Actionscript to load captions from array to dynamic text when thumb is clicked

    i have this code below that i made using a tutorial....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening.
    i dont know where i am going wrong as i have no output or compiled errors
    var locVar = new Array();
    locVar = imgLoc.split(",");
    trace ( locVar );
    var tmbVar = new Array();
    tmbVar = tmbLoc.split(",");
    trace ( tmbVar );
    var capVar = new Array();
    capVar = imgCap.split(",");
    trace ( capVar );
    var NPICS:Number = locVar.length;     // number of pictures to load
    var PICX:Number = 32.8;               // x loc of big picture
    var PICY:Number = 24.9;               // y loc
    var THUMBHOLDERX:Number = 50;        // x location of thumbnail holder movieclip
    var THUMBHOLDERY:Number = 457;      // y location
    var THUMBW:Number = 100;             // width of each thumbnail
    var THUMBH:Number = 75;             // height
    var MARGIN:Number = 10;             // margin between thumbnails
    var TOTALBYTES:Number = 212000;     // approx sum of bytes in all jpgs (x 2)
    var MAXPIXELS:Number = 12;          // max number of pixels to move slider per frame
    // mask definition; mask is assumed to cover some part of the thumbnail slider (here the numbers
    // were chosen so that there are margins between the mask and the right and left edges of the movie
    // (which is 420 x 290), and enough space above and below the thumbs to show them when they 'grow'
    // on mouseover
    var MASKX:Number = 0;                    // start x location of mask
    var MASKW:Number = 600;                    // mask width
    var MASKY:Number = 447.9;                    // start y location of mask
    var MASKH:Number = 92;                    // mask height
    var totalloaded:Number = 0;         // running tally of bytes loaded from all pics
    // index into pictures array, used for loading
    var ipic:Number;
    // set up loader, an instance of MovieClipLoader
    var loader:MovieClipLoader = new MovieClipLoader();
    // use the main timeline to listen to and respond to loader's broadcast events
    loader.addListener(this);
    // function to move thumbnail slider ("this" = thumbs_mc)
    function sliderControl() {
       var w:Number = this._width/2;
       var hw:Number = mask_mc._width/2;
       var npixels:Number;
       // only do when mouse over slider mask
       if (_ymouse > mask_mc._y && _ymouse < mask_mc._y + mask_mc._height) {
          // mouse over left half of slider:
          if (_xmouse > mask_mc._x && _xmouse < mask_mc._x + hw) {
             npixels = (hw - _xmouse) / hw * MAXPIXELS;
             this._x += npixels;
             if (this._x >= 0) this._x = this._x - w;
          // mouse over right half of slider:
          } else if (_xmouse > mask_mc._x + hw && _xmouse < mask_mc._x + mask_mc._width) {
             npixels = (_xmouse - hw) / hw * MAXPIXELS;
             this._x -= npixels;
             if (this._x <= -w) this._x = this._x + w;
    // thumbnail click (onrelease) handler
    function openPic() {
       pic_mc.loadMovie(locVar[this.i]);
    function brightON(){
         this._alpha = 300;
    function brightOFF(){
         this._alpha = 30;
    function captionTXT(){
         _root.cap_txt = capVar;
    // assign event handlers (called when all jpgs are loaded)
    function setupHandlers() {
       pct_txt.removeTextField();          // don't need loading indicator any more
       thumbs_mc.onEnterFrame = sliderControl;
       for (var i:Number = 0; i < NPICS*2; i++) {
          thumbs_mc["mc"+i].onRollOver = brightON;
          thumbs_mc["mc"+i].onRollOut = brightOFF;
          thumbs_mc["mc"+i].onMouseDown = captionTXT;
          thumbs_mc["mc"+i].onRelease = openPic;
    // listener function for broadcast 'done' message (for each pic)
    // onLoadInit gets executed when the movieclip has been loaded into _mc AND
    //   its width and height data are available.
    //   (_mc = the movieclip being loaded into)
    // this routine sets the size and position of each thumbnail clip as its jpg
    //   is loaded and starts the next one loading.  When all have been loaded,
    //   a random picture is loaded into pic_mc and setupHandlers is called to
    //   assign handlers to each thumbnail movieclip
    function onLoadInit(_mc:MovieClip) {
       // this gets done when the jpg is completely loaded:
       _mc._width = THUMBW;
       _mc._height = THUMBH;
       _mc._alpha = 30;          // for image clarity
       // give the movieclip a property to remind it who it is
       // (used by openPic to know which big picture to open)
       _mc.i = (ipic >= NPICS ? ipic-NPICS : ipic);
       // add picture size to totalloaded variable
       totalloaded += loader.getProgress(_mc).bytesTotal;
       // now load the next one (if there are more) or set up handlers if done
       ipic++;
       if (ipic == NPICS * 2) {
          // start with a random photo displayed when all thumbs loaded
          pic_mc.loadMovie(locVar[Math.floor(Math.random()*NPICS)]);
          setupHandlers();
       } else if (ipic >= NPICS) {
          // load jpg into duplicate thumbnail (will already be cached)
          loader.loadClip(tmbVar[ipic-NPICS],  thumbs_mc["mc"+ipic]);
       } else {
          // load jpg into thumbnail
          loader.loadClip(tmbVar[ipic],  thumbs_mc["mc"+ipic]);
    // listener function to handle broadcast progress messages
    // make pct_txt show cumulative loading progress
    function onLoadProgress(_mc:MovieClip, loaded:Number) {
       var loadedsofar:Number = totalloaded + loaded;    
       pct_txt.text = Math.floor(loadedsofar / TOTALBYTES * 100) + "%";
    function init() {
       // create holder for pictures
       createEmptyMovieClip("pic_mc", 1);
       pic_mc._x = PICX;
       pic_mc._y = PICY;
       // create (and draw) holder for thumbnails
       createEmptyMovieClip("thumbs_mc", 2);
       thumbs_mc.beginFill(0, 100);     // black
       thumbs_mc.moveTo(0, 0);
          thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, 0);
       thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, THUMBH);
       thumbs_mc.lineTo(0, THUMBH);
       thumbs_mc.endFill();
       // drawing the thumb holder at 0, 0 and then moving it makes its reg point = upper left
       thumbs_mc._x = THUMBHOLDERX;
       thumbs_mc._y = THUMBHOLDERY;
       // create, draw and enable mask over thumbs (could use different variables to define mask
       // if desired)
       createEmptyMovieClip("mask_mc", 3);
       mask_mc.beginFill(0x0000cc, 100);
       mask_mc.moveTo(0, 0);
       mask_mc.lineTo(MASKW, 0);
       mask_mc.lineTo(MASKW, MASKH);
       mask_mc.lineTo(0, MASKH);
       mask_mc.endFill();
       mask_mc._x = MASKX;
       mask_mc._y = MASKY;
       thumbs_mc.setMask(mask_mc);
       // create loading textfield indicator
       createTextField("pct_txt", 4, 200, 100, 40, 100);
       var tf:TextFormat = new TextFormat();
       tf.align = "center";
       tf.size = 12;
       tf.font = "Verdana";
       tf.color = 0xFFFF00;
       pct_txt.setNewTextFormat(tf);
       // create loading textfield indicator
       createTextField("cap_txt", 0, 400, 200, 40, 100);
       var cf:TextFormat = new TextFormat();
       cf.align = "center";
       cf.size = 12;
       cf.font = "Verdana";
       cf.color = 0xFFFF00;
       cap_txt.setNewTextFormat(cf);
       // make empty movieclips in thumbs_mc for each pic to go into
       // make double the number so the slider can move continuously and show content
       for (var i:Number = 0; i < NPICS * 2; i++) {
          var mc:MovieClip = thumbs_mc.createEmptyMovieClip("mc"+i, i+1);
          mc._x = i*(MARGIN + THUMBW);
          mc._y = 0;
       // set the pointer to the first jpg in the array picnames
       ipic = 0;
       // start loading jpgs (ipic is initialized to 0)
       loader.loadClip(locVar[ipic], thumbs_mc["mc"+ipic]);
    init();
    stop();

    ok here is my code so far.....i've set a movieclip where i want the captions and set the dyn text box above the clip....i've given the movieclip a background n faded so images can still be seen behind.
    im just having a problem with the loop.....each one i tried resulted in the caption staying the same no matter what thumbnail is clicked.
    are there any suggestions as to how this can be done......(please bare in mind im a newbie to actionscript)
    var locVar = new Array();
    locVar = imgLoc.split(",");
    var tmbVar = new Array();
    tmbVar = tmbLoc.split(",");
    var capVar = new Array();
    capVar = imgCap.split(",");
    var NPICS:Number = locVar.length;     // number of pictures to load
    var PICX:Number = 32.8;               // x loc of big picture
    var PICY:Number = 24.9;               // y loc
    var THUMBHOLDERX:Number = 50;        // x location of thumbnail holder movieclip
    var THUMBHOLDERY:Number = 457;      // y location
    var THUMBW:Number = 100;             // width of each thumbnail
    var THUMBH:Number = 75;             // height
    var MARGIN:Number = 10;             // margin between thumbnails
    var TOTALBYTES:Number = 212000;     // approx sum of bytes in all jpgs (x 2)
    var MAXPIXELS:Number = 12;                    // max number of pixels to move slider per frame
    var CAPSW:Number = 525;                    
    var CAPSH:Number = 28;     
    var CAPSX:Number = 38;            //caption text x position
    var CAPSY:Number = 391;            //caption text y position
    // mask definition; mask is assumed to cover some part of the thumbnail slider (here the numbers
    // were chosen so that there are margins between the mask and the right and left edges of the movie
    // (which is 420 x 290), and enough space above and below the thumbs to show them when they 'grow'
    // on mouseover
    var MASKX:Number = 0;                    // start x location of mask
    var MASKW:Number = 600;                    // mask width
    var MASKY:Number = 447.9;                    // start y location of mask
    var MASKH:Number = 92;                    // mask height
    var totalloaded:Number = 0;         // running tally of bytes loaded from all pics
    // index into pictures array, used for loading
    var ipic:Number;
    // set up loader, an instance of MovieClipLoader
    var loader:MovieClipLoader = new MovieClipLoader();
    // use the main timeline to listen to and respond to loader's broadcast events
    loader.addListener(this);
    // function to move thumbnail slider ("this" = thumbs_mc)
    function sliderControl() {
       var w:Number = this._width/2;
       var hw:Number = mask_mc._width/2;
       var npixels:Number;
       // only do when mouse over slider mask
       if (_ymouse > mask_mc._y && _ymouse < mask_mc._y + mask_mc._height) {
          // mouse over left half of slider:
          if (_xmouse > mask_mc._x && _xmouse < mask_mc._x + hw) {
             npixels = (hw - _xmouse) / hw * MAXPIXELS;
             this._x += npixels;
             if (this._x >= 0) this._x = this._x - w;
          // mouse over right half of slider:
          } else if (_xmouse > mask_mc._x + hw && _xmouse < mask_mc._x + mask_mc._width) {
             npixels = (_xmouse - hw) / hw * MAXPIXELS;
             this._x -= npixels;
             if (this._x <= -w) this._x = this._x + w;
    // thumbnail click (onrelease) handler
    function openPic() {
            pic_mc.loadMovie(locVar[this.i]);
    function brightON(){
         this._alpha = 300;
    function brightOFF(){
         this._alpha = 30;
    function captionTXT(){
         cap_txt.text = capVar[this.i];
    // assign event handlers (called when all jpgs are loaded)
    function setupHandlers() {
       pct_txt.removeTextField();          // don't need loading indicator any more
       thumbs_mc.onEnterFrame = sliderControl;
       for (var i:Number = 0; i < NPICS*2; i++) {
          thumbs_mc["mc"+i].onRollOver = brightON;
          thumbs_mc["mc"+i].onRollOut = brightOFF;
          thumbs_mc["mc"+i].onMouseDown = captionTXT;
          thumbs_mc["mc"+i].onRelease = openPic;
    // listener function for broadcast 'done' message (for each pic)
    // onLoadInit gets executed when the movieclip has been loaded into _mc AND
    //   its width and height data are available.
    //   (_mc = the movieclip being loaded into)
    // this routine sets the size and position of each thumbnail clip as its jpg
    //   is loaded and starts the next one loading.  When all have been loaded,
    //   a random picture is loaded into pic_mc and setupHandlers is called to
    //   assign handlers to each thumbnail movieclip
    function onLoadInit(_mc:MovieClip) {
       // this gets done when the jpg is completely loaded:
       _mc._width = THUMBW;
       _mc._height = THUMBH;
       _mc._alpha = 30;          // for image clarity
       // give the movieclip a property to remind it who it is
       // (used by openPic to know which big picture to open)
       _mc.i = (ipic >= NPICS ? ipic-NPICS : ipic);
       // add picture size to totalloaded variable
       totalloaded += loader.getProgress(_mc).bytesTotal;
       // now load the next one (if there are more) or set up handlers if done
       ipic++;
       if (ipic == NPICS * 2) {
          // start with a random photo displayed when all thumbs loaded
           var calc:Number = Math.floor(Math.random()*NPICS);
          pic_mc.loadMovie(locVar[0]);
           cap_txt.text = capVar[0];
          setupHandlers();
       } else if (ipic >= NPICS) {
          // load jpg into duplicate thumbnail (will already be cached)
          loader.loadClip(tmbVar[ipic-NPICS],  thumbs_mc["mc"+ipic]);
       } else {
          // load jpg into thumbnail
          loader.loadClip(tmbVar[ipic],  thumbs_mc["mc"+ipic]);
    // listener function to handle broadcast progress messages
    // make pct_txt show cumulative loading progress
    function onLoadProgress(_mc:MovieClip, loaded:Number) {
       var loadedsofar:Number = totalloaded + loaded;     
       pct_txt.text = Math.floor(loadedsofar / TOTALBYTES * 100) + "%";
    function init() {
       // create holder for pictures
       createEmptyMovieClip("pic_mc", 1);
       pic_mc._x = PICX;
       pic_mc._y = PICY;
       // create (and draw) holder for thumbnails
       createEmptyMovieClip("thumbs_mc", 2);
       thumbs_mc.beginFill(0, 100);     // black
       thumbs_mc.moveTo(0, 0);
       thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, 0);
       thumbs_mc.lineTo(2 * (MARGIN + THUMBW) * NPICS, THUMBH);
       thumbs_mc.lineTo(0, THUMBH);
       thumbs_mc.endFill();
       // drawing the thumb holder at 0, 0 and then moving it makes its reg point = upper left
       thumbs_mc._x = THUMBHOLDERX;
       thumbs_mc._y = THUMBHOLDERY;
       // create, draw and enable mask over thumbs (could use different variables to define mask
       // if desired)
       createEmptyMovieClip("mask_mc", 3);
       mask_mc.beginFill(0x0000cc, 100);
       mask_mc.moveTo(0, 0);
       mask_mc.lineTo(MASKW, 0);
       mask_mc.lineTo(MASKW, MASKH);
       mask_mc.lineTo(0, MASKH);
       mask_mc.endFill();
       mask_mc._x = MASKX;
       mask_mc._y = MASKY;
       thumbs_mc.setMask(mask_mc);
       // create loading textfield indicator
       createTextField("pct_txt", 4, 200, 100, 40, 100);
       var tf:TextFormat = new TextFormat();
       tf.align = "center";
       tf.size = 12;
       tf.font = "Verdana";
       tf.color = 0xFFFF00;
       pct_txt.setNewTextFormat(tf);
       createEmptyMovieClip("caps_mc", 5);
       caps_mc.beginFill(0x000000, 50);
       caps_mc.moveTo(0, 0);
       caps_mc.lineTo(CAPSW, 0);
       caps_mc.lineTo(CAPSW, CAPSH);
       caps_mc.lineTo(0, CAPSH);
       caps_mc.endFill();
       caps_mc._x = CAPSX;
       caps_mc._y = CAPSY;
       // create loading textfield indicator
       createTextField("cap_txt", 6, 38, 380, 525, 25);
       var cf:TextFormat = new TextFormat();
       cf.align = "center";
       cf.size = 16;
       cf.font = "Arial Black";
       cf.color = 0xFFFFFF;
       cap_txt.setNewTextFormat(cf);
       cap_txt._x = CAPSX;
       cap_txt._y = CAPSY;
       // make empty movieclips in thumbs_mc for each pic to go into
       // make double the number so the slider can move continuously and show content
       for (var i:Number = 0; i < NPICS * 2; i++) {
          var mc:MovieClip = thumbs_mc.createEmptyMovieClip("mc"+i, i+1);
          mc._x = i*(MARGIN + THUMBW);
          mc._y = 0;
       // set the pointer to the first jpg in the array locVar
       ipic = 0;
       // start loading jpgs (ipic is initialized to 0)
       loader.loadClip(locVar[ipic], thumbs_mc["mc"+ipic]);
       cap_txt.text = capVar[2];
    init();
    stop();

  • Newbie having difficulty centering images in browser using ActionScript 3.0

    I'm a newbie using flex builder 3. I'm learning
    ActionScript3.0. After running the AS code from the book, my images
    are never in the center of the browser(IE7). After running the
    following code (which is supposed to produce a yellow arrow, in the
    center of the stage, that rotates to the mouse), I get all the
    desired results except the arrow is positioned in the bottom right
    corner of my browser and only part of the arrow is visible. if
    anyone can suggest a solution it would be highly appreciated.
    Please keep in mind that I am a COMPLETE newbie to ActionScript,
    Flex Builder 3, and the Flash environments. Thanks in advance.

    on mouseup or click, if the mouse is down, you can use:
    stage.focus=outputText;
    if the mouse isn't down, you can don't need a listener to trigger the above.

  • Adding focusOut=" " to TextInput generates errors. 

    I am trying to add focusOut to a textInput that is created
    within actionscript.
    I am getting this error: Access of possibly undefined
    property focusOut through a reference with static type
    mx.controls:TextInput.
    What am I missing?
    Thanks in advance for helping me learn flex.
    var txtinput1:TextInput = new TextInput;
    txtinput1.width = 430;
    txtinput1.id = x[j].@id;
    txtinput1.focusOut= "performValidation(event)";
    txtinput1.focusEnabled = true;

    Yes. It is included and defined. You can see function below.
    Thanks.
    private function performValidation(eventObj:Event):void {
    zipV.listener=eventObj.currentTarget;
    zipV.validate(eventObj.currentTarget.text);
    var txtinput1:TextInput = new TextInput;
    txtinput1.width = 430;
    txtinput1.id = x[j].@id;
    txtinput1.focusOut= "performValidation(event)";
    txtinput1.focusEnabled = true;
    <mx:ZipCodeValidator id="zipV"
    triggerEvent=""/>

  • Trying to dynamically add TextInput into HGroup, need some help

    Hey all, I am trying to add a TextInput instance into an HGroup instance all in actionscript, but I am getting an error (implicit coersion, unrelated type to IVisualElement). Doesn't the TextInput class implement the IVisualElement Interface?? Here is a snippit of my code:
    var myHG:HGroup = new HGroup();
    var myTI:TextInput = new TextInput();
    myHG.addElement(myTI); // gives me the error
    However, when I dynamically create radiobuttons, I have no prob adding them to my hgroup??  any ideas of what I am doing wrong??

    UIComponent in flex 4 (and later) implements IVisualElement, so that error is unexpected. If you have a small test case then log a bug at http://bugs.adobe.com/jira
    -Gaurav
    http://www.gauravj.com/blog

  • Sound Button, ActionScript 3.0

    Hi, I am a newbie to ActionScript but I do have an understanding of scripting. I have worked in designing games on a few game engines and now I am looking into ActionScript 3.0
    I created a script by getting some details here and there on the web and this is what Ive come up with,
    var loadSnd:URLRequest = new URLRequest("Sound.wav");
    var thisSnd:Sound = new Sound();
    thisSnd.load(loadSnd);
    Sound_1.addEventListener(MouseEvent.CLICK, playF);
    function playF(event:MouseEvent);void{
              thisSnd:play(); //Line 8
    Output:
    Scene 1, Layer 'Actions', Frame 1, Line 8
    1084: Syntax error: expecting rightbrace before semicolon.
    I dont think this is a difficult error to fix but it is an issue for me at the moment.

    another error in your code:
    kglad wrote:
    use:
    var loadSnd:URLRequest = new URLRequest("Sound.wav");
    var thisSnd:Sound = new Sound();
    thisSnd.load(loadSnd);
    Sound_1.addEventListener(MouseEvent.CLICK, playF);
    function playF(event:MouseEvent):void{
              thisSnd.play(); //Line 8

  • Keyboard won't go up on TextInput focus flex 4.6-iOS

    hi,
    i'm using the TextInput with a custom skin i've made.
    after upgrading to flex 4.6 no keyboard event is triggered when focousing on the TextInput.
    i've noticed some messages on the forum about the issue with no workaround\solution. anyone?

    I rolled back to the 4.5.1 TextInput skin myself. Stage text caused to many problems for me, and I had no need for the features it provides. No more issues since...
    //  ADOBE SYSTEMS INCORPORATED
    //  Copyright 2010 Adobe Systems Incorporated
    //  All Rights Reserved.
    //  NOTICE: Adobe permits you to use, modify, and distribute this file
    //  in accordance with the terms of the license agreement accompanying it.
    package spark.skins.mobile
    import flash.events.Event;
    import flash.events.SoftKeyboardEvent;
    import flash.system.Capabilities;
    import mx.core.DPIClassification;
    import mx.core.EventPriority;
    import mx.core.mx_internal;
    import spark.components.TextInput;
    import spark.components.supportClasses.StyleableTextField;
    import spark.skins.mobile.supportClasses.TextSkinBase;
    import spark.skins.mobile160.assets.TextInput_border;
    import spark.skins.mobile240.assets.TextInput_border;
    import spark.skins.mobile320.assets.TextInput_border;
    use namespace mx_internal;
    *  ActionScript-based skin for TextInput controls in mobile applications.
    * @see spark.components.TextInput
    *  @langversion 3.0
    *  @playerversion Flash 10
    *  @playerversion AIR 2.5
    *  @productversion Flex 4.5
    public class TextInputSkin extends TextSkinBase
        //  Constructor
         *  Constructor.
         *  @langversion 3.0
         *  @playerversion Flash 10
         *  @playerversion AIR 2.5
         *  @productversion Flex 4.5
        public function TextInputSkin()
            super();
            // on iOS, make adjustments for native text rendering
            _isIOS = (Capabilities.version.indexOf("IOS") == 0);
            switch (applicationDPI)
                case DPIClassification.DPI_320:
                    borderClass = spark.skins.mobile320.assets.TextInput_border;
                    layoutCornerEllipseSize = 24;
                    measuredDefaultWidth = 600;
                    measuredDefaultHeight = 66;
                    layoutBorderSize = 2;
                    break;
                case DPIClassification.DPI_240:
                    borderClass = spark.skins.mobile240.assets.TextInput_border;
                    layoutCornerEllipseSize = 12;
                    measuredDefaultWidth = 440;
                    measuredDefaultHeight = 50;
                    layoutBorderSize = 1;
                    break;
                default:
                    borderClass = spark.skins.mobile160.assets.TextInput_border;
                    layoutCornerEllipseSize = 12;
                    measuredDefaultWidth = 300;
                    measuredDefaultHeight = 33;
                    layoutBorderSize = 1;
                    break;
        //  Variables
         *  @copy spark.skins.spark.ApplicationSkin#hostComponent
        public var hostComponent:TextInput;  // SkinnableComponent will populate
         *  @private
        private var _isIOS:Boolean;
         *  @private
        private var _isEditing:Boolean;
         *  @private
        override protected function createChildren():void
            super.createChildren();
            textDisplay.addEventListener("editableChanged", editableChangedHandler);
            // remove hit area improvements on iOS when editing
            if (_isIOS)
                textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_ACTIVATING, textDisplay_softKeyboardActivatingHandler, false, EventPriority.DEFAULT_HANDLER);
                textDisplay.addEventListener(SoftKeyboardEvent.SOFT_KEYBOARD_DEACTIVATE, textDisplay_softKeyboardDeactivateHandler);
         *  @private
        override protected function measure():void
            super.measure();
            var paddingLeft:Number = getStyle("paddingLeft");
            var paddingRight:Number = getStyle("paddingRight");
            var paddingTop:Number = getStyle("paddingTop");
            var paddingBottom:Number = getStyle("paddingBottom");
            var textHeight:Number = getStyle("fontSize") as Number;
            if (textDisplay)
                // temporarily change text for measurement
                var oldText:String = textDisplay.text;
                // commit styles so we can get a valid textHeight
                textDisplay.text = "Wj";
                textDisplay.commitStyles();
                textHeight = textDisplay.measuredTextSize.y;
                textDisplay.text = oldText;
            // width is based on maxChars (if set)
            if (hostComponent && hostComponent.maxChars)
                // Grab the fontSize and subtract 2 as the pixel value for each character.
                // This is just an approximation, but it appears to be a reasonable one
                // for most input and most font.
                var characterWidth:int = Math.max(1, (getStyle("fontSize") - 2));
                measuredWidth =  (characterWidth * hostComponent.maxChars) +
                    paddingLeft + paddingRight + StyleableTextField.TEXT_WIDTH_PADDING;
            measuredHeight = paddingTop + textHeight + paddingBottom;
         *  @private
        override protected function layoutContents(unscaledWidth:Number,
                                                   unscaledHeight:Number):void
            super.layoutContents(unscaledWidth, unscaledHeight);
            // position & size border
            if (border)
                setElementSize(border, unscaledWidth, unscaledHeight);
                setElementPosition(border, 0, 0);
            // position & size the text
            var paddingLeft:Number = getStyle("paddingLeft");
            var paddingRight:Number = getStyle("paddingRight");
            var paddingTop:Number = getStyle("paddingTop");
            var paddingBottom:Number = getStyle("paddingBottom");
            var unscaledTextWidth:Number = unscaledWidth - paddingLeft - paddingRight;
            var unscaledTextHeight:Number = unscaledHeight - paddingTop - paddingBottom;
            // default vertical positioning is centered
            var textHeight:Number = getElementPreferredHeight(textDisplay);
            var textY:Number = Math.round(0.5 * (unscaledTextHeight - textHeight)) + paddingTop;
            // On iOS the TextField top and bottom edges are bounded by the padding.
            // On all other platforms, the height of the textDisplay is
            // textHeight + paddingBottom to increase hitArea on bottom.
            // Note: We don't move the Y position upwards because TextField
            // has way to set vertical positioning.
            // Note: iOS is a special case due to the clear button provided by the
            // native text control used while editing.
            var adjustedTextHeight:Number = (_isIOS && _isEditing) ? textHeight : textHeight + paddingBottom;
            if (textDisplay)
                // We're going to do a few tricks to try to increase the size of our hitArea to make it
                // easier for users to select text or put the caret in a certain spot.  To do that,
                // rather than set textDisplay.x=paddingLeft,  we are going to set
                // textDisplay.leftMargin = paddingLeft.  In addition, we're going to size the height
                // of the textDisplay larger than just the size of the text inside to increase the hitArea
                // on the bottom.  We'll also assign textDisplay.rightMargin = paddingRight to increase the
                // the hitArea on the right.  Unfortunately, there's no way to increase the hitArea on the top
                // just yet, but these three tricks definitely help out with regards to user experience. 
                // See http://bugs.adobe.com/jira/browse/SDK-29406 and http://bugs.adobe.com/jira/browse/SDK-29405
                // set leftMargin, rightMargin to increase the hitArea.  Need to set it before calling commitStyles().
                var marginChanged:Boolean = ((textDisplay.leftMargin != paddingLeft) ||
                    (textDisplay.rightMargin != paddingRight));
                textDisplay.leftMargin = paddingLeft;
                textDisplay.rightMargin = paddingRight;
                // need to force a styleChanged() after setting leftMargin, rightMargin if they
                // changed values.  Then we can validate the styles through commitStyles()
                if (marginChanged)
                    textDisplay.styleChanged(null);
                textDisplay.commitStyles();
                setElementSize(textDisplay, unscaledWidth, adjustedTextHeight);
                // set x=0 since we're using textDisplay.leftMargin = paddingLeft
                setElementPosition(textDisplay, 0, textY);
            if (promptDisplay)
                promptDisplay.commitStyles();
                setElementSize(promptDisplay, unscaledTextWidth, adjustedTextHeight);
                setElementPosition(promptDisplay, paddingLeft, textY);
         *  @private
        private function editableChangedHandler(event:Event):void
            invalidateDisplayList();
         *  @private
        private function textDisplay_softKeyboardActivatingHandler(event:SoftKeyboardEvent):void
            if (event.isDefaultPrevented())
                return;
            _isEditing = true;
            invalidateDisplayList();
         *  @private
        private function textDisplay_softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
            _isEditing = false;
            invalidateDisplayList();

  • PanelGrid with binding attribute not rendering when event on page fires

    I am having a similar issue with my components not being rendered from a dynamic binding attribute as described by this post:http://forum.java.sun.com/thread.jspa?threadID=671672 but for different reason. I have combed the forum and other sources for a week now, tried numerous variations of this based on suggestions I've read for rendering dynamic components and am unable to find the problem. I would appreciate guidance as I don't know what else to do and I imagine there is something basic about the JSF flow layout or component classes I am not doing correctly.
    From a high level, I have a page with two panel groups. The first contains a list of command links (like a menu) that have an actionlistener that populates a list of QueryVariable objects called filterCriteria in the backing bean based on the selection made and then calls a function to update components in the second panel. The second panelGroup contains a panelGrid with a binding attribute that constructs a dynamic set of input fields based on the content of the filterCriteria list. When I first naviagate to this page from another page, the fields are rendered properly. However, if I then select a commandLink from the menu, the panelGrid disappears and is not rendered.
    I've stepped through the code in a debugger and my actionlistener is called when I select a command link. However, the binding attribute method is not called at this time, so I added a direct call to it from the action listener. I know the actionlistener is working because I've verified it in the debugger and if I navigate away and come back to the page, then the binding method is called and the new selection is reflected in a rendered panelGrid. Why is it not rendering though when I first select the commandLink and the page is updated. Also, fyi, there is an action method for the commandlinks but it returns null;
    FWIW, I'm using MyFaces and Facelets in my application.
    Below is my code. This is inside a managed session bean:
    JSF Snippet:
    <h:panelGrid id="inputVarsTable" columns="3" binding="#{query.table}"/>
         public HtmlPanelGrid getTable() {
              if(table == null)
                   table = new HtmlPanelGrid();
              return constructSearchInputTable();               
         public void setTable(HtmlPanelGrid table) {
              this.table = table;
      // Updates table component to reflect filterCriteria
         public HtmlPanelGrid constructSearchInputTable()
              HtmlOutputLabel outLabel;
              HtmlOutputText outText;
              HtmlInputText  inText;
              HtmlMessage message;
              List<UIComponent> children;
              ValueBinding vb;
              FacesContext facesContext = FacesContext.getCurrentInstance();
              UIViewRoot uIViewRoot = facesContext.getViewRoot();
            Application application = facesContext.getApplication();
              children = table.getChildren();
        children.clear();
              try {
                   for (int i = 0; i < getFilterCriteria().size(); i++) {
                        QueryVariable var = getFilterCriteria().get(i);
                        String id = "var" + i;
                        //<h:outputLabel for="#{var.name}" styleClass="label">
                        outLabel = new HtmlOutputLabel();               
                        outLabel.setFor(id);
                        outLabel.setStyleClass("label");
                        //  <h:outputText value="#{var.name}" />
                        outText = new HtmlOutputText();
                        outText.setValue(var.getName());
                        outText.setParent(outLabel);
                        outLabel.getChildren().add(outText);
                        outLabel.setParent(table);
                        children.add(outLabel);
                        //<h:inputText id="#{var.name}" value="#{var.value}" required="true" />
                        inText = new HtmlInputText();
                        inText.setId(id);
                        String bind = "#{query.filterValues['" + var.getName() + "']}";
                        inText.setValueBinding("value", application.createValueBinding(bind));
                        if(var.getDefaultValue() == null)
                             inText.setRequired(true);
                        inText.setParent(table);
                        children.add(inText);
                        //<h:message for="#{var.name}" styleClass="errorText"/>
                        message = new HtmlMessage();
                        message.setFor(id);
                        message.setStyleClass("errorText");
                        message.setParent(table);
                        children.add(message);     
              } catch (Exception e) {
                   log.error(e);
              return table;
      // Command Link Menu ActionListener
         public void structuredQuerySelection(ActionEvent e) {
              queryType = QueryType.StructuredQuery;
              UICommand cmd = (UICommand) e.getSource();
              filterSelection = (String) cmd.getValue();
              Map<String, SearchRequestCtx> queries = pdp.getGenericMetadata().savedQueries;
              SearchRequestCtx ctx = queries.get(filterSelection);
              filterCriteria = new ArrayList<QueryVariable>();
              filterCriteria.addAll(ctx.getVariables());
              constructSearchInputTable();
         // Command Link Menu Action
         public String selectStructuredQuery()
              return null;
         }BTW, this is my first post and I don't really know how that Duke Dollar thing works but I'm happy to offer some to anyone that can solve this issue for me.
    Thanks,
    Ken

    Glad to hear I am not the only one struggling with this type of issue.
    I tried your suggestion but it caused a NoSuchElementException when the page tried to render. Stepping through the code, the init function is always called after my panelGrid is constructed. I even commented out the logic to clear the children and confirmed that in the constructed page, the outputText component that binds to init is the first element on the page - right after the opening body tag. Maybe, JSF doesn't necessarily construct the page in top to bottom order? Also, the exception makes me think that this gets called too late in the lifecycle to work. Were you able to get this to work?
    java.util.NoSuchElementException
         at java.util.AbstractList$Itr.next(AbstractList.java:427)
         at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:515)
         at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:445)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)Ken

  • How do I get Flash to recognize my TextInput from class?

    Hi -
    I'm trying to write a class for a standard input form. I've
    got a movieclip in the library and have linked it to this class.
    (class included below.)
    This movieclip contains several text inputs which I have
    declared in my class file. I can get their ._x and ._y values, but
    I can't assign to the .text value of the TextInput. Nor can I read
    this value when I set it in the parameters tab in flash. It just
    comes up as undefined.
    It's as though flash does not recognize the instance that was
    placed on the stage in the authoring environement as a TextInput. I
    can trace out the instance, but Flash does not treat it as a
    TextInput because I can not assign a string to the .text property.
    If I instantiate the TextInput in my class file and then
    position it on the stage - I can assign to it. But this is not as
    practical because I can not lay things out visually in Flash. How
    do I get Flash to recognize my TextInput instance on the stage from
    a class file?
    Thanks in advance!
    import mx.controls.TextInput;
    import mini.slide.*;
    class mini.slide.InfoCollect extends Slide{
    var first:TextInput;
    var testInput:TextInput;
    var last:TextInput;
    var email:TextInput;
    var address:TextInput;
    var city:TextInput;
    var zip:TextInput;
    var phone:TextInput;
    function InfoCollect(){
    trace("InfoCollect created");
    this.first = new TextInput();
    this.first.text = "testing";
    trace("this.first = " + this.first.text);
    }

    Since you are putting the assignment and trace statements in
    the Constructor function, it is possible that the textInput boxes
    have not all yet loaded. So, when you are trying to assign values
    to them, they are not present on the stage.
    Put your code in an onLoad function. That way you can insure
    that all components have loaded before you assign values to them.
    The onLoad function will be called when the "onLoad" event is
    triggered after all of your movieclip has loaded.
    function onLoad() {
    ---your code here---
    }

  • Binding a Group ?

    Hi All,
    what I'm trying to do is a simple Group binding. I.e. I start my application with nothing and then add a group to the Scene. Later, I'll want to destroy/remove this Group and add another Group.
    If you imagine from a very simplistic point of view, I want a Group to appear after a few seconds, then remove this Group and add another dynamically (using opacity and keyframes to fade out and in each Group - which will require each Group to have an opacity of 0 to start with).
    All the examples I've seen only change values inside a node (such as the URL for an image etc...), but what if I want to completely remove that ImageView Node, or on a greater scale, a whole Group?
    Is this possible, or even better, am I not thinking of it the right way and is there a better way of doing it?
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.animation.Timeline;
    import javafx.scene.Group;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.paint.Color;
    import javafx.scene.Cursor;
    import javafx.animation.KeyFrame;
    var groupA = Group {
                   content: [
                      Rectangle {
                         width: 800
                         height: 50
                         fill: Color.BLUE
                         cursor: Cursor.HAND
    var t1= Timeline {
         //repeatCount: Timeline.INDEFINITE
         keyFrames : [
                KeyFrame { time: 0s action: function(){ println("Hello at 0s") } },
                KeyFrame { time: 2s action: function():Void{ setMainNode(groupA) } },
                KeyFrame { time: 4s action: function() { println("Hello at 4s") } },
    t1.play();
    var mainGroup:Group;// = bind groupA;
    function setMainNode(settingGroup:Group):Void{
       println("Setting mainGroup");
       mainGroup = settingGroup;
    Stage {
        title: "Testies"
        scene: Scene {
            width: 800
            height: 600
            content: [
                  mainGroup
    }

    Yep! the FadeTransition Basics was me too, that led me to where I am now... slightly even more confused! =)
    I see what you're doing there and at first glance it looks really good. However, I still see a flicker of the second image at the very start (no doubt due to the 1ms fade out time), which leads me to wonder if the images were not directly on top of each other, would you notice this even more? I guess so.
    I think there is no real way to "fade in" anything from 0 without that flicker using a fadeTransition (I notice you're using Windows, I'm using Linux, so maybe there is a difference between the display in that 1ms?), unless you explicitly set the opacity to 0 at the start?
    To get around the flicker, I went this way (using the opacity and keyframes as I mentioned before. It's not nice as there are a lot of extra stuff you have to do like setting each Group to be opacity: 0.0 (or at least binding to the opacityState and being careful when you use it). Your way is definitely more elegant, but I just can't seem to get rid of that flicker (1ms?) :/
    * Main.fx
    * Created on 25-May-2010, 16:37:00
    package testfading;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.animation.Timeline;
    import javafx.scene.Group;
    import javafx.animation.KeyFrame;
    import javafx.animation.Interpolator;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.paint.Color;
    import javafx.scene.Cursor;
    var opacityStateTop = 0.0;
    var opacityStateMiddle = 0.0;
    //var groupAInstance = GroupA{opacityState: bind opacityStateTop}
    //var groupA = groupAInstance.getGroupA();
    //var groupBInstance = GroupB{opacityState: bind opacityStateTop}
    //var groupB = groupBInstance.getGroupB();
    //var groupCInstance = GroupC{opacityState: bind opacityStateMiddle}
    //var groupC = groupCInstance.getGroupC();
    var groupA = Group {
                   content: [
                      Rectangle {
                         width: 800
                         height: 50
                         fill: Color.GREEN
                         cursor: Cursor.HAND
                   opacity: bind opacityStateTop
       var groupB = Group {
                   content: [
                      Rectangle {
                         width: 800
                         height: 50
                         fill: Color.RED
                         cursor: Cursor.HAND
                   opacity: bind opacityStateTop
       var groupC = Group {
                   content: [
                      Rectangle {
                         y: 50
                         width: 800
                         height: 50
                         fill: Color.BLUE
                         cursor: Cursor.HAND
                   opacity: bind opacityStateMiddle
    var groupNULL = Group {
                   content: []
    var t1= Timeline {
         //repeatCount: Timeline.INDEFINITE
         keyFrames : [
                // Set the top part
                KeyFrame { time: 0s action: function():Void{ setMainTop(groupA) } },
                // Fade in the top part after 2 seconds of nothing
                KeyFrame { time: 2s action: function():Void{ fadeInTop.playFromStart(); } },
                // Fade out top part after leaving fully visible for 2s
                KeyFrame { time: 6s action: function():Void{ fadeOutTop.playFromStart(); } },
                // Set the top and middle parts after full fade out of top
                KeyFrame { time: 8s action: function():Void{ setMainTop(groupB); setMainMiddle(groupC) } },
                // Fade in both top and middle parts
                KeyFrame { time: 8s action: function():Void{ fadeInTop.playFromStart(); fadeInMiddle.playFromStart();} },
    t1.play();
    var fadeInTop= Timeline {
         keyFrames : [
                KeyFrame {
                   time: 1s
                   values: [opacityStateTop => 1.0 tween Interpolator.LINEAR]
    var fadeOutTop= Timeline {
         keyFrames : [
                KeyFrame {
                   time: 1s
                   values: [opacityStateTop => 0.0 tween Interpolator.LINEAR]
    var fadeInMiddle= Timeline {
         keyFrames : [
                KeyFrame {
                   time: 2s
                   values: [opacityStateMiddle => 1.0 tween Interpolator.LINEAR]
    var mainTop:Group;
    var mainMiddle:Group;
    function setMainMiddle(settingGroup:Group):Void{
       println("Setting mainMiddle.");
       mainMiddle = settingGroup;
    function setMainTop(settingGroup:Group):Void{
       println("Setting mainTop.");
       mainTop = settingGroup;
    Stage {
        title: "Testies"
        scene: Scene {
            width: 800
            height: 300
            content: bind [mainTop,mainMiddle]
    }

  • How to add actionscript to a movie symbol

    I am a complete newbie to actionscript and flash. I am using
    Flash CS3 with Mac OSX.
    I need to know how to add actionscript to a movie symbol?
    I made a circle and coverted it into movie symbol. After
    selecting it and opening Windows > Actions, it says that the
    currect selection can not have actions applied to it.
    I have also tried ticking the Export for actionscript option
    and leaving the default options on, but still no use.
    can someone please help me?

    ticking Export for actionscript isnt doing anything for you,
    thats to attach a movie from the library... click your movie clip
    symbol, in the properties panel, click where it says 'Instance
    Name', and give it a unique name, lets say, my_mc. then in an
    actions layer, ON A KEYFRAME, add this
    my_mc.onRelease
    or
    my_mc.onRollOver
    or
    my_mc.onRollOut
    and so on, but that's how you reference the movie clip... by
    its instance name

  • ActionScript 3 - XML - NavigateToURL

    Ok there are many tutorials out there on how to use this function, what I am trying to do and can't seem to find a tutorial on is using navigateToURL with the "mailto" email address being populated from an XML list.
    For example you have a list of offices and each office has a lead. I want to populate a List component with the office name, and when clicked I want it to open the email client and populate the To: and Subject line from the xml file.
    What I have so far populates the Office name into the list and when clicked  the mail client will open but doesnt populate the To because I can't figure it out.
    I believe I need to specify a var to pull the email address from the xml list, I just cant seem to get it right.
    here is a snippet example of my xml code
    <officeleads>
      <office>
       <officenm>PDX</officenm>
       <emllink>[email protected]</emllink>   <-------- I want this to populate the "To:" in an email
      </office>
    </officeleads>
    and here is my ActionScript
    var leadloader:URLLoader = new URLLoader();
    leadloader.addEventListener(Event.COMPLETE, onLoaded);
    leadlist.addEventListener(Event.CHANGE, openMailClient);
    function openMailClient(l:Event):void
    var request:URLRequest = new URLRequest();
    request.url="mailto:"                 <----------  this is where I know I need to somehow specify the emllink in the xml file to be filled into the "To:"
    navigateToURL(request,"Self");
    var xml:XML;
    function onLoaded (l:Event):void
      xml = new XML(l.target.data);
      var offlst:XMLList = xml.office;
      for (var i:uint=0; i<offlst.length();i++)
       leadlist.addItem({data:offlst.officenm.text()[i],
           label:offlst.officenm.text()[i]});
    leadloader.load(new URLRequest("officeleads.xml"));
    Any help will be greatly appreciated.
    Thanks
    Sam
    AS3 Noob

    try:
    import fl.events.ListEvent;
    var leadloader:URLLoader = new URLLoader();
    leadloader.addEventListener(Event.COMPLETE, onLoaded);
    leadlist.addEventListener(ListEvent.ITEM_CLICK, openMailClient);
    function openMailClient(e:ListEvent):void {
       var request:URLRequest=new URLRequest("mailto:"+leadlist.getItemAt(int(e.rowIndex)).data);
        navigateToURL(request,"_self");
    var xml:XML;
    function onLoaded(l:Event):void {
        xml = new XML(l.target.data);
        var offlst:XMLList = xml.office;
        for (var i:uint=0; i<offlst.length(); i++) {
           leadlist.addItem({data:offlst.emllink.text()[i],
                   label:offlst.officenm.text()[i]});
    leadloader.load(new URLRequest("officeleads.xml"));

  • Cannot pass variables from PHP to actionscript 3.0

    I am using CS3 and I write the following code as to pass variable to flash from PHP
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    PHP file
    <?php
       echo ('values = 8');
    ?>
    But I always get the error and cannot get the values by using trace();
    Before i try to use "myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;" I still get the same error.
    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
              at Error$/throwError()
              at flash.net::URLVariables/decode()
              at flash.net::URLVariables$iinit()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    Can anyone help me?

    The error is fixed.The new version is like that
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    php file
    <?php
       echo "values=8";
    ?>
    The output finally is "null" in flash file. Why does it happen? It should give me 8 when I input trace(myValue);

Maybe you are looking for

  • DVI KVM switch to use with iMac and Cinema Display

    I currently have a 20" iMac that I use with a 20" Cinema Display. I'd like to share the Cinema display between the iMac and a Dell computer. Assuming this can be done, are there any recommendations for a DVI-KVM switch? Most important is no loss in v

  • Communications Express doesn't create access Manager SSO session

    Hi all, I'm running Communications Express, Sun Access Manager and Sun messaging server, each on seperate hosts. Single Sign On works i.e. when users have a valid session and point their browser at the Communications Express URL they can access their

  • I have the new version of itunes and i cant find where i can convert my songs into mp3s... anyone know where?

    can someone help me find where the tab is for converting songs into MP3's... my copnmputer just updated iTunes and i cant convert them... i need these songs in that format and i cant find it anywhere... help!

  • Having email trouble with iPad

    All of a sudden I'm not receiving emails on my iPad, it just keeps on saying the mail server "imapgmail.com is not responding verify if I have entered the correct account into mail settings

  • Hayaku - simple application launcher

    Hello! Hayaku is a simple application launcher. Ideally, you bind it to a keyboard shortcut to launch rapidly a program. You can also enter an url and your web browser will open it. Every unique command is save in a sql table (SQLite) to be load next