Sunday, April 4, 2010

New to Actionscript: need SharedObject...

Hi, I'm new to Actionscript.



I am using a program called Page-Flip (
http://page-flip.com) to make an
online catalog. Everything is working fine, but I am trying to
modify it a little using Actionscript. I'm trying to use
SharedObject to have the document remember what page of the catalog
was last viewed.



Here's a link to what I have:


http://www.portcityracing.com/general/assets/swf/all-in-one/Actionscript.html



Right now, Everything works as expected: the user can
navigate to the desired page. When on that page, the user can click
on a part number , and be taken from the .swf file to an HTML page
showing the product.



When the user goes back to the page-flip catalog, they are
brought to the front of the catalog. I would like them to be able
to come back to where they left off. If they were last on page 27,
I'd like them to return to page 27 next time they go to the
page-flip.



Here's the custom code that I have added, but it seems to be
doing nothing at all:

/*Custom Code Custom Code Custom Code */

var so = SharedObject =
SharedObject.getLocal(''FlippingBook'');

/*End of Custom Code*/





/*Custom Code Custom Code Custom Code */

myBook.onPutPage = function(){

clearInterval(flipInterval);

if( so.data.pageNumber != undefined ){

flipInterval = setInterval( this, ''flipGotoPage'', 1000,
so.data.pageNumber );

}

so.data.pageNumber = ( this.leftPageNumber == undefined ) ?
this.rightPageNumber : this.leftPageNumber;

};

/*End of Custom Code*/



What do I need to change to make this work?

Thanks in advanceNew to Actionscript: need SharedObject...
the first equal sign in your first block of code should be a
colon.



the 2nd block of code makes no sense, but it could make sense
if flipGotoPage() had complementary code.New to Actionscript: need SharedObject...

quote:




Originally posted by:
kglad


the first equal sign in your first block of code should be a
colon.





A colon gives me the following error:

**Error** Scene=Scene 1, layer=actions, frame=1:Line 5:
Syntax error.

var so: SharedObject =
SharedObject.getLocal(''FlippingBook'');



Total ActionScript Errors: 1 Reported Errors: 1
well, like all object declarations, there shouldn't be a
space between your colon and SharedObject.

quote:




Originally posted by:
kglad


well, like all object declarations, there shouldn't be a
space between your colon and SharedObject.





Here's what I get when I take out the spaces around the
colon:



**Error** Scene=Scene 1, layer=actions, frame=1:Line 5:
Syntax error.

var so:SharedObject.getLocal(''FlippingBook'');



Total ActionScript Errors: 1 Reported Errors: 1




the line below is from your original post.




Thanks. That took care of the syntax error.



I guess a more important question is, could you recommend a
good book on Actionscript? I have only one Sitepoint book which
covers Flash MX 2004. I have Flash Pro 8 here at work.



My original page flip problem is not solved, but thanks for
your ''syntax help.''



Dale
you're welcome.



for as2, flash 8 actionscript bible contains lots of
information but i don't really think it would be very helpful
except as a reference.

No comments:

Post a Comment