flash actionscript:
Hi all, I've experience a strange problem with MX2004 - AS 1 - player 6. In my application I've defined some arrays. _root.myarray1 = new Array () _root.myarray1[17] = -1 _root.myarray1[16] = -1 I save it in a local SOL. Cookies = sharedobject.getlocal("game"); Cookies.data.myarray1 = _rootmyarray1; Unfortunately, if I test the movie, Flash crash. In fact I've checked that if I've invert the order assigning value to position, everythings goes well. _root.myarray1 = new Array () _root.myarray1[16] = -1 _root.myarray1[17] = -1 Seeing in the SOL with .SOL Editor, I've noticed tha arrya is saved in the definition order (position 17 before 16). If I change the definition order, everything goes well. If I trace the array before saving, it's same in both cases. Also trying to open the SOL with Sephiroth Sol reader, doesn't succed. Have anyone have experienced the problem? Suggestions? My problem isn't the start definition (I can change the order), but the application is a game, and the array is used to save resource collected (not always in the same order). Thanks, Norby
_root.myarray1 = new Array () _root.myarray1[17] = -1 _root.myarray1[16] = -1
Thank you. I tried : _root.myarray1 = new Array (20) _root.myarray1[17] = -1 _root.myarray1[16] = -1 But this doesn't solve the problem... ;-( Bye,
[quoted text, click to view] "norby77" <webforumsuser@macromedia.com> wrote in message news:d4o0tt$b1f$1@forums.macromedia.com... > Thank you. > I tried : > _root.myarray1 = new Array (20) > _root.myarray1[17] = -1 > _root.myarray1[16] = -1 > > But this doesn't solve the problem... ;-( > > Bye, > Norby
Norby, it's probably not anything to do with the crash, but make sure you use semicolons at the end of each statement. Being on a different line doesn't make it a new statement. (maybe you are already doing it) tralfaz
The problem lies here Cookies = sharedobject.getlocal("game"); Cookies.data.myarray1 = _rootmyarray1;/// it should be _root.myarray1 missing dot
tralfaz, Flashkernel thanks a lot for the advices. Unfortunately they doesn't solve. I've inserted the semicolons, but anything canges. The missing dot is my fault in posting the code, I'm sorry. To clarify, my code works: the SOL it's generated and the values stored. The problem is the structure of the SOL, the array position are stored in the assignement order, causing malfunction. I don't know the SOL specification, so I can't say if it's a problem in writing (array position has to be in order) or reading the SOL (the order isn't imperative, but the player crash in reading it). Thanks a lot, Norby
tralfaz, thanks a lot. Your advice it's anyway useful. I've done "copy & paste", only changed variable name (to make code more readable). In fact I'm publishing in Player 6, AS 1 cause some code used it was developed in MX, and can be very difficult to check all syntax (not only case sensitive, but also variable declaration). Anyway, I've make a small .fla to test only this problem and isolate it. This is the code: Frame 1 actions _root.myarray1 = new Array (); _root.myarray1[17] = -1; _root.myarray1[16] = -1; Frame 2 acrions Cookies = SharedObject.getLocal("test"); Cookies.data.myarray1 = _root.myarray1; Trace ("_root.myarray1"+_root.myarray1) Trace ("Cookies.data.myarray1"+Cookies.data.myarray1) trace("saved the cookies") Cookies.flush(); I hope in this way can be more simple to understand my problem.
[quoted text, click to view] "norby77" <webforumsuser@macromedia.com> wrote in message news:d4q4rn$e0c$1@forums.macromedia.com... > tralfaz, Flashkernel > thanks a lot for the advices. > > Unfortunately they doesn't solve. > I've inserted the semicolons, but anything canges. > The missing dot is my fault in posting the code, I'm sorry.
norby.. probably more useless advice but with MX2004 it is case sensitive so should be SharedObject with the capitol letters (as pointed out by another poster recently). Shouldn't make it crash though and you say it is writing the SOL file. I would recommend using copy/paste when posting your code instead of typing it in just so that typos aren't brought up. tralfaz
Don't see what you're looking for? Try a search.
|