registerLazyAttachSection

0 views
Skip to first unread message

Koojav

unread,
Apr 24, 2007, 6:20:27 AM4/24/07
to Gugga Flash Framework
Hi!

I was trying to use registerLazyAttachSection but unfortunately I've
failed. I tried searching for some examples but it seems that there
are none.

Could anyone post an example usage of registerLazyAttachSection and
explain to me how gugga.components.SectionAttacher works ?

Stefan Yotov

unread,
Apr 24, 2007, 2:45:12 PM4/24/07
to gug...@googlegroups.com
Hi Koojav,

Here is some sample code for registering lazy attach sections from the scope of SectionsController:

var mc : MovieClip = mSectionsContainer.attachMovie("SectionAttacher", aInstanceName, mSectionsContainer.getNextHighestDepth ());
var sectionAttacher : SectionAttacher = SectionAttacher(mc);
registerLazyAttachSection(sectionAttacher, "[section symbol id in the library]", "[section id]", true);

The mSectionsContainer can be a movie clip from the SectionsController or the controller itself.

SectionAttacher is an ITask which attaches a section from the library on the stage and then starts its initialization. When the section is initialized the SectionAttacher completes.

The purpose of SectionAttacher is to provide ISectionLoader implementation for attaching lazy sections. We were motivated to create ISectionLoader in order to load different lazy sections in a similar fashion.
To allow that the ISectionLoader defines events "sectionAvailable", "sectionUIInitialized", "sectionInitialized" and method unloadData.
An example of such a polymorphic usage exists in the SectionsTransition. When the SectionsTransition has to open a lazy section it uses ISectionLoader. When the ISectionLoader dispatches "sectionUIInitialized" the SectionsTransitions starts to monitor initialization progress of the Section no matter if it is an external swf or just a library symbol. In fact during most of the time the SectionsTransition doesn't know the class of the section loader, which resulted in easier implementation and flexible transition.

We hope that the sample code helps and stay open for any other questions.

Sincerely,
Gugga Team

Reply all
Reply to author
Forward
0 new messages