A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: 'path' in an Array

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    1

    'path' in an Array

    I was trying to put a 'path' in an Array


    // I Create the Array
    var matrizFunc:Array=new Array();

    // put What a need inside it
    matrizFunc [0] = 'Tela.AreaInterativaLogin.entrar';

    //I call the Array element to work with the Listener
    matrizFunc[0].addEventListener(MouseEvent.CLICK,TelaMenuInicial );

    It doens't work. Any clue?

    tks a lot!

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    322
    PHP Code:
    function get_target(p,c) {
        if (!
    p.getChildByName(c) ) {
            return;
        }
        return 
    p.getChildByName(c);
    }
    function 
    target_path(str,sep) {
        var 
    obj:Array=str.split(sep);
        var 
    doc:DisplayObjectContainer=this;
        for (var 
    n=0n<obj.lengthn++) {
            
    doc=get_target(doc,obj[n]);
        }
        if (!
    doc) {
            return;
        }
        return 
    doc;
    }
    function 
    clicked(evt:MouseEvent):void {
        
    trace(evt.target.name);
    }

    var 
    matrizFunc:Array=new Array();
    matrizFunc[0] = "Tela.AreaInterativaLogin.entrar";

    var 
    c=target_path(matrizFunc[0],".");
    try {
        
    c.addEventListener(MouseEvent.CLICKclicked);
    } catch (
    c) {
        
    trace("ERROR: Path Invalid.");



    marlopax

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