Thursday, December 29, 2005

Lesson learned: undefined

When will I learn this: Whenever anything turns out to be undefined (except the getBounds-object, which tracelines as undefined even when it's not, in line with Macromedia's no-logic-policy), be sure to put it in a setInterval, even if all bytes are loaded, and even if it displays correctly. setInterval should always be the first option. Final lesson learned in this respect involves the ScrollPane component. The method to access the content of the ScrollPane in Flash 8 is simply

scrollPaneInstance.content

This works like a charm in the fla in which it resides, but when called from outside, content is undefined although scrollPaneInstance is very defined. I created a separate method for changing a property of the content, called it with setInterval, and everything works again perfectly. I do realise that the content isn't necessarily loaded even if the ScrollPane is, however, when bytesLoaded equals bytesTotal, it really wouldn't be way off if that meant everything was loaded, including the content. Further, can it possibly be necessary that absolutely everything is completely asynchronous? Maintaining code-readability in this framework is a job on its own.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home

En blogg kan være et godt verktøy for en som i litt for stor grad glemmer de små og store tingene som utgjør livet. Dette er min reserve- hukommelse.