Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
now a Page added dynamically, displays the fold gradient correctly.
Browse files Browse the repository at this point in the history
blvz committed Jul 14, 2010
1 parent 75b9c17 commit 84cbf21
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FlexBook #

- Current Version: 1.0.2
- Current Version: 1.0.3
- Flex 3.5 / AS3 / Flash Player 9+
- Date: 4th July 2007
- Original Author: Ruben Swieringa
@@ -13,6 +13,7 @@ For demos / implementations, look at this repo:

- Fixed the 'sticky-page' bug
- Added the jumptoPage method. It's similar to the gotoPage method, but it won't do a lot of flips to reach some page.
- Fixed the bug that, when adding a Page dynamically, the Page didn't show fold gradients.

## Known Issues / Bugs

7 changes: 3 additions & 4 deletions src/com/rubenswieringa/book/Book.as
Original file line number Diff line number Diff line change
@@ -104,10 +104,9 @@ package com.rubenswieringa.book {
* Ruben Swieringa created this component during his internship at the Factor.e (www.tfe.nl). Thanks to those guys for allowing me to publish the source-code online!
*
* @author Ruben Swieringa
* ruben.swieringa@gmail.com
* www.rubenswieringa.com
* www.rubenswieringa.com/blog
* @version 1.0.1
* and others.
* http://github.com/rthesaint/FlexBook
* @version 1.0.3
* @see PageManager PageManager
* @see Page Page
* @see BookEvent BookEvent
11 changes: 11 additions & 0 deletions src/com/rubenswieringa/book/Page.as
Original file line number Diff line number Diff line change
@@ -122,11 +122,22 @@ package com.rubenswieringa.book {

this._gradients = new Gradients(this);

this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

// disable scrolling to force this Page its fold-gradient to remain in place (this issue may be addressed in future versions):
super.horizontalScrollPolicy = ScrollPolicy.OFF;
super.verticalScrollPolicy = ScrollPolicy.OFF;
}

/**
* When added to the stage (added to a Book), force the initialize and drawFoldGradient methods.
* @private
*/
private function onAddedToStage(event : Event) : void {
this.initialize();
this.drawFoldGradient();
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}

/**
* Static style initializer. Sets default style settings for all Page instances. Executed only once.

0 comments on commit 84cbf21

Please sign in to comment.