A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Action script: How to display array's elements

Threaded View

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    12

    Action script: How to display array's elements

    Hi everyone,
    In a fla file (flash8) I added an "Input-text" naming the var: "varInput",
    and selected "Numeral [0..9]" from "Character Embedding".
    I added another input object, this time of "Dynamic -text" text type
    naming the var: "varOutput". I also added a button naming its' instance name:
    "btnDisplay".
    In "actions" panel I wrote the following code:
    Code:
    btnDisplay.onRelease = function() 
    {
     varOutput=myArr[varInput];
    };
    var varInput:Number=0;
    var varOutput:String="";
    var myArr:Array=new Array("a","b","c");
    Running this code i get 2 errors (at least):
    1. The input text box (varInput) accepts non numeric fonts althoug i selected only numeric
    characters from the "Character Embedding"?
    2.When i select: control->test movie I get an error message that says:
    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
    btnDisplay.onRelease=function()

    Total ActionScript Errors: 1 Reported Errors: 1
    Can anyone explain why those 2 errors occur ?
    Attached is the fla file.
    Thanks
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center