Home

Downloads

FAQs

Sample Book

Features

Forum

 

Inter-Page ActionScript

It is possible for actionscript on one page to affect the contents of another page. To workout the path to your page content you could (temporarily) put the following AS on frame 1 of your pages.

trace("page ="+_root.page+" this="+this);

The path to the left hand page (on top) would be like this :-

 _level0.pages.p1.page.pf.ph.pic.pX

where X is the page number and the path to the right hand page (on top) would be like this :-

_level0.pages.p4.page.pf.ph.pic.pX

NOTE:

Provided your page is running inside pageFlip then _root and _level0 are the same thing (unless you fiddle with _lockroot).

If you run pageFlip inside a container movieclip then you should set _lockroot=true; on frame 1 of pageFlip_BNN since the pageflip code does reference _root a lot.

This is tricky territory so make sure you understand it and also check out the Flash help for _lockroot. Using it inside your loaded pages etc could prevent your loaded SWF from accessing any of the _level0/_root variables etc in pageFlip.

So, to continue, if you have a button called myBtn on the left hand page and a movieclip called myClip on the right hand page then the myBtn could be used to load a movieclip into myClip like this:-

btn.onPress=function()
{
_level0.pages.p1.page.pf.ph.pic.pX.myClip.loadMovie("path to movie");
}

Remember to replace the X with the correct page number.

Background Info

To handle transparency and page turning the pages are referenced via an array (pageClips) which has 6 elements.

Usage
pageClips array indexes
usage
Left page turning
2
3
Right page turning
Left page on top
1
4
Right page on top
Left page on bottom (for transparency)
0
5
Right page on bottom (transparency)

This gives us the paths to the pages :-

Path to page container movieclip What it points to
_level0.pages.p0.page.pf.ph.pic.pX Left page X on bottom (transparency)
_level0.pages.p1.page.pf.ph.pic.pX Left page X on top
_level0.pages.p4.page.pf.ph.pic.pX Right page X on top
_level0.pages.p5.page.pf.ph.pic.pX Right page X on bottom (transparency)

Notice the p0, p1, p4, p5 in the paths - these relate to the index in the pageClips array in the script actions_f6.as.