Re: [Flashcoders] Question about the AIR security model...

2008-04-25 Thread John Eriksson
Yeah it is backwards for me. I would have to change every swf loaded for
this to work.
The byteArray suggestion is the best suggestion so far, gotta try that out
:-)

I've actually solved my problem in an unorthodox way currently. I've written
a check method
that does a describeType on the content of the Loader and if it sees that it
implements the proper interface
and also has all the proper methods it oks the swf.

To actually call the methods of the loaded swf I had to use an untyped var -
then it doesn't complain. I
only do this after my check method has ok'd it.


Thanks,
John

2008/4/24 Ian Thomas [EMAIL PROTECTED]:

 Hi Peter,

   It's the first time I've come across sandbox bridging. It's a nifty idea.

 The Flash documentation for it is here:

 http://livedocs.adobe.com/flex/3/langref/flash/display/LoaderInfo.html#childSandboxBridge

 But... unfortunately I think it's backwards for John's problem. It
 allows a parent SWF to expose properties to a child SWF, rather than
 the other way around...

 Ian

 On Thu, Apr 24, 2008 at 9:58 AM, Peter B [EMAIL PROTECTED] wrote:
  Could sandbox bridging help here?
 
   http://www.adobe.com/devnet/air/ajax/quickstart/sandbox_bridge.html
 
   This example descibes loading local HTML files, but the same rules
 apply...
 
   Pete
 
 
  ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Converting a ByteArray to string and back again...

2008-04-25 Thread John Eriksson
I've been messing around with the ByteArray for some time now, and I wonder
if there isa way to convert the ByteArray to a string (ie using toString())
and then converting that string
back into a ByteArray which would then be the same as the original
ByteArray.

This would mean I could include an AMF serialized object in an xml document
and later deserialize
it from that string in the xml...

Is this possible? ByteArray doesn't have a fromString method and I've
tried writeUTF and writeUTFBytes but that
doesn't seem to be right.

I did manage to get the bytes one by one from the byte array, creating a
string like 10,245,343,12.,
and later doing some split() join() stuff to finally assemble the ByteArray
- but this seems a bit complex and
maybe even slow. Am I missing something? Can it be done much faster?


Kind regards,
John
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Question about the AIR security model...

2008-04-24 Thread John Eriksson
Yes. I have understood this when doing some research on the subject. My
problem though is that I don't want theswfs to be installed together with
the app (a few thousand swfs altogether). I want my AIR App to load a dir
full of them
and walk through them all and check if they implement a certain interface.
I've done all these things, my only problem now
is that I cannot cast them in AIR at all which makes the whole thing
pointless.

You see my problem here right? I need it to load arbitrary swfs from a
harddrive or network share (i.e locally through the filesystem)
and try to cast them to an interface - throw up a warning or generate a list
of swfs that do not conform to the interface and need to
be fixed.

I guess this cannot be easily done, or perhaps not at all... Could it be
possible through a sandbox bridge or something like that?

/John

2008/4/24 Ian Thomas [EMAIL PROTECTED]:

 Hi John,
   Where are you loading the SWF from?

   I think I had this problem early on with AIR, and it turned out I
 was loading from the wrong place. If you load the .swf files from
 within the AIR app's installed folder, then they are given full rights
 and you will be able to cast them etc. If you load them from anywhere
 else, they are placed into a different security sandbox and you won't
 be able to cast them.

  This page should help:
 http://livedocs.adobe.com/flex/3/html/security_6.html
 (see under URL schemes)

 Hope that's helpful,
   Ian

 On Wed, Apr 23, 2008 at 6:50 PM, John Axel Eriksson [EMAIL PROTECTED]
 wrote:
  I'm trying to develop an application using AIR for internal use at our
  company.
 
   Our company uses very advanced actionscript (3.0) on the web, we load
 for
  instance
   several hundred or maybe more swfs sometimes into a parent swf, some
 that
  are animated.
 
   Recently we decided that we need control over these loaded animated
 swfs -
  they need
   to adhere to an interface so we can stop the animations from the
 loading
  application when needed.
   The animations can be both timeline based and script based. As long as
 they
  adhere to the interface
   (basically play() stop() reset() and the running getter should return
  true if playing or false if stopped) we should be just fine.
 
   The problem is that we need people who don't really know any scripting
  (designers) to be able to publish these
   files properly. And I guess a template goes a long way but still...
 
   So I thought: Hey there's AIR which have local filesystem access among
  other things. I could build an AIR App which
   loads a swf or even a whole dir of swfs and then casts the loaded swfs
 to
  IAnimatedItem and throws an error if it cant.
   It could also include play stop reset buttons to test every loaded swf
  manually to be sure it works. Nice indeed and simple
   enough for most people to use...
 
   The problem is though that I can't cast loaded swfs in AIR it seems,
 though
  I can from a simple swf loading one of these items
   (but then I lose filesystem dialogs etc which is why I thought of AIR
 in
  the first place).
 
   In AIR
   var aim:IAnimatedItem = loader.content as IAnimatedItem; (or
  loader.contentLoaderInfo.content as IAnimatedItem doesn't matter).
 
   aim becomes null.
 
   In simple Flash swf:
 
   aim becomes IAnimatedItem.
 
 
   if I do this in AIR:
 
   var aim:IAnimatedItem = loader.content as IAnimatedItem;
 
   if(aim is IAnimatedItem){
  trace('is IAnimatedItem');
   } else {
  trace('is NOT IAnimatedItem');
   }
 
   this traces 'is NOT IAnimatedItem';
 
   **
 
   in simple Flash swf the same traces:
 
   'is IAnimatedItem';
 
   **
 
   Also, doing a describeType in AIR OR Flash swf actually says it DOES
  implement IAnimatedItem. But, as I said, only in normal
   flash swfs is it castable to an IAnimatedItem. Why? Does this have
  something to do with the AIR security model and does anyone
   know how I can achieve what I want in AIR?
 
 
   /John
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] using scrollRect and the width / height properties in AS3 F9 - weirdness

2008-04-01 Thread John Eriksson
This code is about the width and height properties not getting changed until
some time in the future (perhaps one frame ahead or a few ms ahead) when
setting a scrollRect. This causes all kinds of problems. The code was very
very simple, just to show that the values are not immediately changed when
setting a scrollRect... I would like to know why that is and what possible
benefits there could be?

The code only shows that setting a scrollRect does NOT immediately change a
DisplayObject's width and height props.

/John

2008/4/1, Pedro Kostelec [EMAIL PROTECTED]:

 I don't get your problem. What is this code about? It has no scrollbar??!!
 If you want to refresh the stage faster (using a timer) just add
 t.updateAfterEvent();


 On Tue, Apr 1, 2008 at 8:26 PM, John Axel Eriksson [EMAIL PROTECTED] wrote:

  Hi.
 
 
  I'm building a simple scrollbar and a scrollcontent class. I'm using
  these in dialogs among other things.
  These dialogs draw a frame around their content based on the contents
  width and height + a margin (to
  describe it simply). I've not had any problems with this until I
  started using my scroll classes and, to be more
  precise, using scrollRects.
 
  What I've found out is that when a scrollRect is set on a
  DisplayObject, the width and height properties on that
  DisplayObject do not reflect the scrollRects values until some time in
  the future (perhaps next frame) - I've tested
  using a timer which traces out the width and height values at
  different times.
 
  My problem is that this messes up the whole displayList hierarchy and
  the only way to get my dialogs to draw right
  is to set some arbitrary timer to fire an event which updates the
  dialog and spefically the frame around the content at
  some time in the future (50-100 ms seems to work, but perhaps a
  shorter period could work as well). This is completely
  INSANE in my opinion and it doesn't even fix all problems for me.
 
  Why do scrollRects work like that? I can't see ANY benefit to it, only
  trouble. Could anyone help out or explain why this
  works the way it does?
 
 
  Try it yourselves:
 
 
  import flash.display.*;
  import flash.geom.*;
  import flash.events.TimerEvent;
  import flash.utils.Timer;
 
  var sp1:Sprite=new Sprite();
  sp1.graphics.beginFill(0x99,1.0);
  sp1.graphics.drawRect(0,0,100,100);
 
  var sp2:Sprite=new Sprite();
  sp2.scrollRect=new Rectangle(0,0,20,20);
 
  sp2.addChild(sp1);
  addChild(sp2);
 
 
  function traceValues(te:TimerEvent=null){
 trace('container width: '+sp2.width);
 trace('child width: '+sp1.width);
  }
 
  traceValues();
 
  var t:Timer=new Timer(100, 1);
  t.addEventListener(TimerEvent.TIMER, traceValues);
  t.start();
 
  stop();

  ___
  Flashcoders mailing list
  Flashcoders@chattyfig.figleaf.com
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 




 --
 Pedro D.K.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders