Deprecated: Assigning the return value of new by reference is deprecated in /var/www/omflash.dk/public_html/wp-includes/cache.php on line 33

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/omflash.dk/public_html/wp-content/plugins/sem-subscribe-me2/sem-subscribe-me.php on line 511

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_query_vars() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1252

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_posts_where() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1252

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_posts_join() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1252

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_tag_templates() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1329
Event.RENDER - omFlash();
Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_add_ajax_javascript() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1329

ActionScript 3 - Objektet der ikke var der, endnu!

Kategori: Tips og tricks | Kommentarer (0)
Gemt: 2007-11-29 11:45



Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/omflash.dk/public_html/wp-includes/functions-formatting.php on line 83

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UltimateTagWarriorActions::ultimate_the_content_filter() should not be called statically in /var/www/omflash.dk/public_html/wp-includes/functions.php on line 1252

Strict Standards: Non-static method UltimateTagWarriorActions::regExEscape() should not be called statically in /var/www/omflash.dk/public_html/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php on line 638

Strict Standards: Non-static method UltimateTagWarriorActions::regExEscape() should not be called statically in /var/www/omflash.dk/public_html/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php on line 638

Strict Standards: Non-static method UltimateTagWarriorActions::regExEscape() should not be called statically in /var/www/omflash.dk/public_html/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php on line 639

Strict Standards: Non-static method UltimateTagWarriorActions::regExEscape() should not be called statically in /var/www/omflash.dk/public_html/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php on line 639

Strict Standards: Non-static method UltimateTagWarriorActions::replaceTagWithLink() should not be called statically in /var/www/omflash.dk/public_html/wp-content/plugins/UltimateTagWarrior/ultimate-tag-warrior-actions.php on line 643

En klassisk metode i ActionScript 2 når man skulle manipulere med objekter i et movieclip var følgende:

MitMC.gotoAndStop("login");
MitMC.Login_txt.text = "Klik for at logge ind";

Men, forsøger du at gøre det i AS3, så får du en fejl, da Login_txt først eksisterer i kodemæssig forstand når det er blevet renderet, det eksisterer ikke blot fordi du er hoppet hen i en frame hvor du ved at det er.

Ved hjælp af eventen RENDER er der dog en måde at gøre noget tilsvarende på:

MitMC.gotoAndStop("login");
MitMC.addEventListener(Event.RENDER, initiateLogin);

function initiateLogin(e:Event) {
MitMC.Login_txt.text = "Klik for at logge ind";
}

Det kræver lidt mere kode end tidligere, men det fungerer fint.

Hvorvidt det så er bad practice eller ej, det vil jeg lade op til andre om at vurdere, men engang imellem er det jo helt okay at hoppe over hvor gærdet er lavest :-)