Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 756

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 811

Deprecated: Function create_function() is deprecated in /home/pasokime/domains/mysql.lt/public_html/forumas/include/parser.php on line 816

1 (edited by QQ 2014-01-01 19:54:10)

Topic: Flash + actionscript 3

Sveiki.

Pradėjau mokytis dirbti su flash ir Actionscript 3 ir sunkiai sekasi.

Turiu forma:
du įvedimo laukus pavadintus: girth ir blenght

Submit mygtukas pavadintas: btn_gtap

Išvedimo laukas pavadintas: ats_text

Trumpas kodas:

stop();
import flash.events.MouseEvent;

btn_gtap.addEventListener(MouseEvent.CLICK, buttonClick);

function buttonClick(e:MouseEvent){
    var ats:String=String(uint(girth.text)+uint(blenght.text));
    ats_text.text=ats;
}

Visas kodas suveikia gražiai jei viska darau pirmame kadre (frame).

Iškyla problema tik tuo atveju, jeigu funkcijos gale įterpiu papildoma koda.

GoToAndPlay(2);

function buttonClick(e:MouseEvent){
    var ats:String=String(uint(girth.text)+uint(blenght.text));
    ats_text.text=ats;
        gotoAndPlay(2);
}

Po paspaudimo parodomas šioks toks filmukas ir tik po to išvedami duomenys i ekrana.

Bet padarius taip gaunu klaida:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at hwcalculator_Scene1_fla::MainTimeline/buttonClick()[hwcalculator_Scene1_fla.MainTimeline::frame1:9]

Si klaida rodoma jeigu ats_text nera pirmame kadre.

kaip padaryt ta ats_text globalu kad išvestu ji bet kuriame kadre, kai tik jis pasirodo?

PS. naudoju Flash cs6