Author Topic: Element Fade in after Load optional...  (Read 900 times)

CainVampyr

  • Jr. Member
  • **
  • Posts: 31
Element Fade in after Load optional...
« on: June 04, 2010, 11:46:27 am »
This is a simple change, like the "fadein" property from the book it would be nice to have a similar switch for pages after being loaded.

For now we'r hacking the AbstractElement with the following:


(...)
public function init():void {
  (...)
        if (!pageside.unloadAfterThumb && pageside.visible) {
            if (MegaZine(megazine).settings.getSetting('fadein')) {
                alpha = 0;
                //*
                var t:ITween = new AlphaTween(0.125, this, 1);
                lec_.add(t, Event.COMPLETE, handleFadeInComplete,
                        LECUtil.AUTO_REMOVE);
                t.start();
                //*/
            } else dispatchEvent(new Event(Event.COMPLETE));
        }
  (...)
}
(...)


Aint perfect but did the trick for now ;)
« Last Edit: June 04, 2010, 02:20:24 pm by CainVampyr »

cecileadam

  • Newbie
  • *
  • Posts: 3
Re: Element Fade in after Load optional...
« Reply #1 on: June 06, 2010, 04:52:42 pm »
I changed the AbstractElement class as you suggested, but with this hack, you get rid of the Event.COMPLETE, and it causes problems.

IMHO, 2 solutions

1) alpha=1 , and the alphaTween runs for nothing
2) get rid of :
if (!pageside.unloadAfterThumb && pageside.visible) {
(...)
}

and replace it by :
dispatchEvent(new Event(Event.COMPLETE))

CainVampyr

  • Jr. Member
  • **
  • Posts: 31
Re: Element Fade in after Load optional...
« Reply #2 on: June 07, 2010, 09:58:26 am »
what do you mean i got rid of the event? It's right there...

If the 'fadein' is set it will run the regular course other wise it will dispatch the event immediately.
Aren't you adding a listener for that event to late or something?

if (MegaZine(megazine).settings.getSetting('fadein')) {
   // This is what it's supposed to do by default
   alpha = 0;
   var t:ITween = new AlphaTween(0.125, this, 1);
   lec_.add(t, Event.COMPLETE, handleFadeInComplete,
   LECUtil.AUTO_REMOVE);
   t.start();
} else {
    // Trigger the event right now since ther's no animation...
    dispatchEvent(new Event(Event.COMPLETE));
}

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1985
  • MegaZine3 Developer
    • MegaZine3
Re: Element Fade in after Load optional...
« Reply #3 on: June 12, 2010, 03:45:39 pm »
Added an attribute book@elementsfadein which controls just that.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

CainVampyr

  • Jr. Member
  • **
  • Posts: 31
Re: Element Fade in after Load optional...
« Reply #4 on: June 14, 2010, 11:49:08 am »
Nice, again thank you kindly for the update!

Keep up the good work ;)