[flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-30 Thread seanmcmonahan
I'm having a similar problem with a subclass of Dictionary.  Unfortunately I 
haven't has an opportunity to try this fix yet, but maybe you'll find it 
useful: 
http://stackoverflow.com/questions/850466/properly-serializing-flash-utils-dictionary-to-a-sharedobject

--- In flexcoders@yahoogroups.com, Geoffrey geoff...@... wrote:

 
 
 Muzak, thank you for your help. However, I have already tried [RemoteClass] 
 (which I mentioned in the original post). I also looked at the link that you 
 provided and decided to try more combinations, but none worked. I have tried 
 [RemoteClass] with and w/o [Bindable], [RemoteClass(alias=ByteArrayPlus)], 
 and I made sure to use my class beforehand. In all cases I can get a custom 
 class to retain its type, but ByteArrayPlus always gets read as ByteArray 
 from the SharedObject.
 
 I believe this may be a problem peculiar to ByteArray, but I don't know 
 exactly why that would be so. 
 
 Again, the challenge is this: make any class that extends ByteArray, write it 
 to a SharedObject (to the disk), read it from the SharedObject, and have it 
 retain its class. I know it sounds straightforward, but I cannot get it to 
 work.
 
 --Geoff
 
 --- In flexcoders@yahoogroups.com, Muzak p.ginneberge@ wrote:
 
  Add a RemoteClass metadata tag to the custom class:
  
  Example at the bottom of the article
  http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
  
  
  - Original Message - 
  From: Geoffrey geoffhom@
  To: flexcoders@yahoogroups.com
  Sent: Wednesday, October 28, 2009 12:45 PM
  Subject: [flexcoders] SharedObject problem/bug? Cannot store a subclass of 
  ByteArray.
  
  
   Hi,
  
   I have a subclass of ByteArray (let's call it ByteArrayPlus), which I 
   want to write to a SharedObject. I can store it fine, but 
   when I read it back, it says it's of type ByteArray, not ByteArrayPlus. 
   Does anyone have an idea what may be wrong? Has anyone 
   gotten this to work?
  
   FYI, I am already using registerClassAlias(). And it works fine with a 
   custom class, and with a custom class extending another 
   custom class. I also tried implementing IExternalizable, but that did not 
   help. I also tried [RemoteClass] and 
   [RemoteClass(alias=ByteArrayPlus)].
  
   Also, ByteArrayPlus is really simple: I only added a String (name) to it.
  
   This is my first post to FlexCoders.
  
   Any help appreciated.
  
   --Geoff
  
 





[flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-30 Thread Geoffrey


Hi Sean,

Thank you for the link; still no luck. I had tried implementing IExternalizable 
before, but after reading your article I decided to try again. I have figured 
out a little more:

--I can extend, say, a Sprite, and it works fine.
--When I save the SharedObject, if I use the Sprite-based class, there are two 
calls to writeExternal(). But for the ByteArray-based class, there is no call 
to writeExternal().
--When I load the SO, the constructor for the Sprite-based class gets called. 
The constructor for the ByteArray-based class does not get called.

I suspect that Adobe's serialization/deserialization code has something that 
checks for type ByteArray (e.g., if (x is ByteArray)). On the write-side, it 
would then call something like writeBytes(), and only call writeExternal() if 
not a ByteArray. On the read-side, it may do something similar when type 
casting.

At this point, I will probably try a workaround for my situation. (E.g., 
encapsulating the ByteArray) But if anyone gets this to work, I would be 
interested to know.

--Geoff

--- In flexcoders@yahoogroups.com, seanmcmonahan s...@... wrote:

 I'm having a similar problem with a subclass of Dictionary.  Unfortunately I 
 haven't has an opportunity to try this fix yet, but maybe you'll find it 
 useful: 
 http://stackoverflow.com/questions/850466/properly-serializing-flash-utils-dictionary-to-a-sharedobject
 
 --- In flexcoders@yahoogroups.com, Geoffrey geoffhom@ wrote:
 
  
  
  Muzak, thank you for your help. However, I have already tried [RemoteClass] 
  (which I mentioned in the original post). I also looked at the link that 
  you provided and decided to try more combinations, but none worked. I have 
  tried [RemoteClass] with and w/o [Bindable], 
  [RemoteClass(alias=ByteArrayPlus)], and I made sure to use my class 
  beforehand. In all cases I can get a custom class to retain its type, but 
  ByteArrayPlus always gets read as ByteArray from the SharedObject.
  
  I believe this may be a problem peculiar to ByteArray, but I don't know 
  exactly why that would be so. 
  
  Again, the challenge is this: make any class that extends ByteArray, write 
  it to a SharedObject (to the disk), read it from the SharedObject, and have 
  it retain its class. I know it sounds straightforward, but I cannot get it 
  to work.
  
  --Geoff
  
  --- In flexcoders@yahoogroups.com, Muzak p.ginneberge@ wrote:
  
   Add a RemoteClass metadata tag to the custom class:
   
   Example at the bottom of the article
   http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
   
   
   - Original Message - 
   From: Geoffrey geoffhom@
   To: flexcoders@yahoogroups.com
   Sent: Wednesday, October 28, 2009 12:45 PM
   Subject: [flexcoders] SharedObject problem/bug? Cannot store a subclass 
   of ByteArray.
   
   
Hi,
   
I have a subclass of ByteArray (let's call it ByteArrayPlus), which I 
want to write to a SharedObject. I can store it fine, but 
when I read it back, it says it's of type ByteArray, not ByteArrayPlus. 
Does anyone have an idea what may be wrong? Has anyone 
gotten this to work?
   
FYI, I am already using registerClassAlias(). And it works fine with a 
custom class, and with a custom class extending another 
custom class. I also tried implementing IExternalizable, but that did 
not help. I also tried [RemoteClass] and 
[RemoteClass(alias=ByteArrayPlus)].
   
Also, ByteArrayPlus is really simple: I only added a String (name) to 
it.
   
This is my first post to FlexCoders.
   
Any help appreciated.
   
--Geoff
   
  
 





RE: [flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-30 Thread Alex Harui
Please file a bug with a small test case.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Geoffrey
Sent: Friday, October 30, 2009 1:35 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of 
ByteArray.




Hi Sean,

Thank you for the link; still no luck. I had tried implementing IExternalizable 
before, but after reading your article I decided to try again. I have figured 
out a little more:

--I can extend, say, a Sprite, and it works fine.
--When I save the SharedObject, if I use the Sprite-based class, there are two 
calls to writeExternal(). But for the ByteArray-based class, there is no call 
to writeExternal().
--When I load the SO, the constructor for the Sprite-based class gets called. 
The constructor for the ByteArray-based class does not get called.

I suspect that Adobe's serialization/deserialization code has something that 
checks for type ByteArray (e.g., if (x is ByteArray)). On the write-side, it 
would then call something like writeBytes(), and only call writeExternal() if 
not a ByteArray. On the read-side, it may do something similar when type 
casting.

At this point, I will probably try a workaround for my situation. (E.g., 
encapsulating the ByteArray) But if anyone gets this to work, I would be 
interested to know.

--Geoff

--- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
seanmcmonahan s...@... wrote:

 I'm having a similar problem with a subclass of Dictionary. Unfortunately I 
 haven't has an opportunity to try this fix yet, but maybe you'll find it 
 useful: 
 http://stackoverflow.com/questions/850466/properly-serializing-flash-utils-dictionary-to-a-sharedobject

 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
 Geoffrey geoffhom@ wrote:
 
 
 
  Muzak, thank you for your help. However, I have already tried [RemoteClass] 
  (which I mentioned in the original post). I also looked at the link that 
  you provided and decided to try more combinations, but none worked. I have 
  tried [RemoteClass] with and w/o [Bindable], 
  [RemoteClass(alias=ByteArrayPlus)], and I made sure to use my class 
  beforehand. In all cases I can get a custom class to retain its type, but 
  ByteArrayPlus always gets read as ByteArray from the SharedObject.
 
  I believe this may be a problem peculiar to ByteArray, but I don't know 
  exactly why that would be so.
 
  Again, the challenge is this: make any class that extends ByteArray, write 
  it to a SharedObject (to the disk), read it from the SharedObject, and have 
  it retain its class. I know it sounds straightforward, but I cannot get it 
  to work.
 
  --Geoff
 
  --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
  Muzak p.ginneberge@ wrote:
  
   Add a RemoteClass metadata tag to the custom class:
  
   Example at the bottom of the article
   http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
  
  
   - Original Message -
   From: Geoffrey geoffhom@
   To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com
   Sent: Wednesday, October 28, 2009 12:45 PM
   Subject: [flexcoders] SharedObject problem/bug? Cannot store a subclass 
   of ByteArray.
  
  
Hi,
   
I have a subclass of ByteArray (let's call it ByteArrayPlus), which I 
want to write to a SharedObject. I can store it fine, but
when I read it back, it says it's of type ByteArray, not ByteArrayPlus. 
Does anyone have an idea what may be wrong? Has anyone
gotten this to work?
   
FYI, I am already using registerClassAlias(). And it works fine with a 
custom class, and with a custom class extending another
custom class. I also tried implementing IExternalizable, but that did 
not help. I also tried [RemoteClass] and
[RemoteClass(alias=ByteArrayPlus)].
   
Also, ByteArrayPlus is really simple: I only added a String (name) to 
it.
   
This is my first post to FlexCoders.
   
Any help appreciated.
   
--Geoff
   
  
 




[flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-30 Thread Geoffrey
Hi Alex,

Fair enough. I submitted it (I think), although I got this message:

You have successfully created the issue (FB-23715), however you do not have 
the permission to view the created issue.

This is probably because you entered a bug report that details a potential 
security vulnerability - or is related to a non-public component in a 
commercial product.

I do not feel experienced enough to know which categories to submit the bug 
under, but I included source code to reproduce the bug.

Alex, thank you for your continual help to the community.

--Geoff

--- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote:

 Please file a bug with a small test case.
 
 Alex Harui
 Flex SDK Developer
 Adobe Systems Inc.http://www.adobe.com/
 Blog: http://blogs.adobe.com/aharui
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
 Behalf Of Geoffrey
 Sent: Friday, October 30, 2009 1:35 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: SharedObject problem/bug? Cannot store a subclass 
 of ByteArray.
 
 
 
 
 Hi Sean,
 
 Thank you for the link; still no luck. I had tried implementing 
 IExternalizable before, but after reading your article I decided to try 
 again. I have figured out a little more:
 
 --I can extend, say, a Sprite, and it works fine.
 --When I save the SharedObject, if I use the Sprite-based class, there are 
 two calls to writeExternal(). But for the ByteArray-based class, there is no 
 call to writeExternal().
 --When I load the SO, the constructor for the Sprite-based class gets called. 
 The constructor for the ByteArray-based class does not get called.
 
 I suspect that Adobe's serialization/deserialization code has something that 
 checks for type ByteArray (e.g., if (x is ByteArray)). On the write-side, it 
 would then call something like writeBytes(), and only call writeExternal() if 
 not a ByteArray. On the read-side, it may do something similar when type 
 casting.
 
 At this point, I will probably try a workaround for my situation. (E.g., 
 encapsulating the ByteArray) But if anyone gets this to work, I would be 
 interested to know.
 
 --Geoff
 
 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
 seanmcmonahan sean@ wrote:
 
  I'm having a similar problem with a subclass of Dictionary. Unfortunately I 
  haven't has an opportunity to try this fix yet, but maybe you'll find it 
  useful: 
  http://stackoverflow.com/questions/850466/properly-serializing-flash-utils-dictionary-to-a-sharedobject
 
  --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
  Geoffrey geoffhom@ wrote:
  
  
  
   Muzak, thank you for your help. However, I have already tried 
   [RemoteClass] (which I mentioned in the original post). I also looked at 
   the link that you provided and decided to try more combinations, but none 
   worked. I have tried [RemoteClass] with and w/o [Bindable], 
   [RemoteClass(alias=ByteArrayPlus)], and I made sure to use my class 
   beforehand. In all cases I can get a custom class to retain its type, but 
   ByteArrayPlus always gets read as ByteArray from the SharedObject.
  
   I believe this may be a problem peculiar to ByteArray, but I don't know 
   exactly why that would be so.
  
   Again, the challenge is this: make any class that extends ByteArray, 
   write it to a SharedObject (to the disk), read it from the SharedObject, 
   and have it retain its class. I know it sounds straightforward, but I 
   cannot get it to work.
  
   --Geoff
  
   --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
   Muzak p.ginneberge@ wrote:
   
Add a RemoteClass metadata tag to the custom class:
   
Example at the bottom of the article
http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
   
   
- Original Message -
From: Geoffrey geoffhom@
To: flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com
Sent: Wednesday, October 28, 2009 12:45 PM
Subject: [flexcoders] SharedObject problem/bug? Cannot store a subclass 
of ByteArray.
   
   
 Hi,

 I have a subclass of ByteArray (let's call it ByteArrayPlus), which I 
 want to write to a SharedObject. I can store it fine, but
 when I read it back, it says it's of type ByteArray, not 
 ByteArrayPlus. Does anyone have an idea what may be wrong? Has anyone
 gotten this to work?

 FYI, I am already using registerClassAlias(). And it works fine with 
 a custom class, and with a custom class extending another
 custom class. I also tried implementing IExternalizable, but that did 
 not help. I also tried [RemoteClass] and
 [RemoteClass(alias=ByteArrayPlus)].

 Also, ByteArrayPlus is really simple: I only added a String (name) to 
 it.

 This is my first post to FlexCoders.

 Any help appreciated.

 --Geoff

   
  
 





[flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-29 Thread Geoffrey


Muzak, thank you for your help. However, I have already tried [RemoteClass] 
(which I mentioned in the original post). I also looked at the link that you 
provided and decided to try more combinations, but none worked. I have tried 
[RemoteClass] with and w/o [Bindable], [RemoteClass(alias=ByteArrayPlus)], 
and I made sure to use my class beforehand. In all cases I can get a custom 
class to retain its type, but ByteArrayPlus always gets read as ByteArray from 
the SharedObject.

I believe this may be a problem peculiar to ByteArray, but I don't know exactly 
why that would be so. 

Again, the challenge is this: make any class that extends ByteArray, write it 
to a SharedObject (to the disk), read it from the SharedObject, and have it 
retain its class. I know it sounds straightforward, but I cannot get it to work.

--Geoff

--- In flexcoders@yahoogroups.com, Muzak p.ginnebe...@... wrote:

 Add a RemoteClass metadata tag to the custom class:
 
 Example at the bottom of the article
 http://cookbooks.adobe.com/post_How_to_keep_the_type_of_your_objects_when_serializ-8323.html
 
 
 - Original Message - 
 From: Geoffrey geoff...@...
 To: flexcoders@yahoogroups.com
 Sent: Wednesday, October 28, 2009 12:45 PM
 Subject: [flexcoders] SharedObject problem/bug? Cannot store a subclass of 
 ByteArray.
 
 
  Hi,
 
  I have a subclass of ByteArray (let's call it ByteArrayPlus), which I want 
  to write to a SharedObject. I can store it fine, but 
  when I read it back, it says it's of type ByteArray, not ByteArrayPlus. 
  Does anyone have an idea what may be wrong? Has anyone 
  gotten this to work?
 
  FYI, I am already using registerClassAlias(). And it works fine with a 
  custom class, and with a custom class extending another 
  custom class. I also tried implementing IExternalizable, but that did not 
  help. I also tried [RemoteClass] and 
  [RemoteClass(alias=ByteArrayPlus)].
 
  Also, ByteArrayPlus is really simple: I only added a String (name) to it.
 
  This is my first post to FlexCoders.
 
  Any help appreciated.
 
  --Geoff
 





[flexcoders] Re: SharedObject problem/bug? Cannot store a subclass of ByteArray.

2009-10-28 Thread Geoffrey


I forgot to mention what versions I am using: Flex SDK 3.4 (via Flex Builder 
3), targeting Flash Player 10.

--- In flexcoders@yahoogroups.com, Geoffrey geoff...@... wrote:

 Hi,
 
 I have a subclass of ByteArray (let's call it ByteArrayPlus), which I want to 
 write to a SharedObject. I can store it fine, but when I read it back, it 
 says it's of type ByteArray, not ByteArrayPlus. Does anyone have an idea what 
 may be wrong? Has anyone gotten this to work?
 
 FYI, I am already using registerClassAlias(). And it works fine with a custom 
 class, and with a custom class extending another custom class. I also tried 
 implementing IExternalizable, but that did not help. I also tried 
 [RemoteClass] and [RemoteClass(alias=ByteArrayPlus)].
 
 Also, ByteArrayPlus is really simple: I only added a String (name) to it.
 
 This is my first post to FlexCoders. 
 
 Any help appreciated.
 
 --Geoff