Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Mon, Feb 22, 2010 at 2:27 PM, Keith Reinfeld wrote: > > Thanks for the clarification, but that ain't doing it either. > > // LoaderInfo > e.currentTarget > > // Bitmap > e.currentTarget.loader.content > Perhaps, but if I trace(displayObject) it traces as the bitmap, so I can use that. Such bei

[Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
Hello, I have multiplayer game, which reads XML data from the server: _socket = new Socket(); _socket.addEventListener(ProgressEvent.SOCKET_DATA, handleTcpData); . private function handleTcpData(event:Event):void { while (_socket.bytesAvailable) { var str:String = _socket.readUTF

[Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Eric E. Dolecki
I'm curious - has anyone seen a tutorial online or seen source for allowing a Flash app to talk back and forth with an iPhone app running on wifi? Sending simple strings. Eric -- http://ericd.net Interactive design and development ___ Flashcoders maili

Re: [Flashcoders] An event when a Sprite's visible changes?

2010-02-23 Thread Alexander Farber
Thank you! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Henrik Andersson
Doing anything but copying the data from the event to your own bytearray buffer object is a disaster waiting to happen. TCP is a stream based protocol, you can get chunks of any length each time the event is reviced. Assume that the chunks are random length and piece them together in a buffer

[Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
I am trying to remove a Sprite via: removeSchild(mySprite); but I get the error: 1120: Access of undefined property mySprite); The Sprite is created ina function and is not neccessarily the child of anything - although it is created via addChild(mySprite) so I guess it is the child of somethin

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Henrik Andersson
Lehr, Theodore wrote: How can I find it an remove it? You need to get a reference to it. I recommend simply storing the one you used with addChild. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/l

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Geografiek
Hi Theodore, When you say 'addChild(mySprite)' mySprite *is* the child of something: the instance you call addChild on (addChild(mySprite) is equal to this.addChild(mySprite)) To remove mySprite you have to call removeChild(mySprite) on the same instance. From the error it seems that myChild

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
that does help - thanks... I traced the parent and get: [object MainTimeLine] How would I incorparate that into: removeChild(mySprite) ? TIA From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Geogr

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
I tried: removeChild(root.mySprite); and I get another error: 1119: Access of possibly undefined property mySprite through a reference with static type flash.display:DisplayObject From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@cha

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Nathan Mynarcik
You could try root.removeChild(mysprite); Or you can try removeChild(getChildByName("mySprite")); Where is your code that is calling this method located? External Doc Class? On the main timeline? Inside or on a movieclip? Nathan Mynarcik Interactive Web Developer nat...@mynarcik.com 254.749.25

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
Hello, On Tue, Feb 23, 2010 at 2:25 PM, Henrik Andersson wrote: > Doing anything but copying the data from the event to your own bytearray > buffer object is a disaster waiting to happen. > > TCP is a stream based protocol, you can get chunks of any length each time > the event is reviced. Assume

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> I presume my removeEventListener works. You should be sure. So check it: trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //true e.currentTarget.removeEventListener(Event.COMPLETE, loaded); trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //false > So, how do I pass new valu

[Flashcoders] accessing event dispatchers in a loosely-coupled, modular design

2010-02-23 Thread Andrew Sinning
Following the discussion about "root" yesterday, it got me thinking about a constant problem I face. Object-A needs to listen to events coming from objects B, C and D, but only if and when these objects actually exist. There's no guarantee that any of the objects B, C and D will be instantiat

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Geografiek
Hi Theodore, In your case try root.removeChild(mySprite); btw: the use of root is not recommended though. There was a discussion lately why. Maybe Jason is willing to illustrate in the case of this example? Willem On 23-feb-2010, at 15:31, Lehr, Theodore wrote: I tried: removeChild(root.m

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
I am new to as3 so all of this is in the main .fla in functions... the Sprite is created in one function and I am trying to remove it in another... I tried the getChildByName and the movie loaded properly - then when the event that calls the removeChild gets fired, I am given: 2007: parameter ch

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Nathan Mynarcik
Ok, I'm sure you are setting your variable inside the function that creates the sprite. This will in turn not allow you to target the sprite correctly. Can you paste the code you are using to create your sprite? Nathan Mynarcik Interactive Web Developer nat...@mynarcik.com 254.749.2525 www.myna

RE: [Flashcoders] accessing event dispatchers in a loosely-coupled, modular design

2010-02-23 Thread Merrill, Jason
If an instance of those classes has been created, then it will eval to true, otherwise it will be null, so this should work for that part of the problem: if(_myinstance) _myInstance.addEventListener(myEvent, myHandler); However, if you're creating "A" after "B", "C", and "D", then you'll want to

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
I can not paste it but this should give you a general idea: function createBar(dfile:String):void { ... var mySprite:Sprite = new Sprite(); function createGraph():void { mySprite.graphics. addChild(mySprite);

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
tried that... no dice - just not seem to be able to find it From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Geografiek [geograf...@geografiek.nl] Sent: Tuesday, February 23, 2010 10:10 AM To: Fl

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Nathan Mynarcik
Bingo! Try this instead: var mySprite:Sprite = new Sprite(); function createBar(dfile:String):void { ... function createGraph():void { mySprite.graphics. addChild(mySprite); } } function clearBar():void {

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Nathan Mynarcik
I have no clue why you have a function inside a function. I am going to assume you have a good reason for it. Nathan Mynarcik Interactive Web Developer nat...@mynarcik.com 254.749.2525 www.mynarcik.com -Original Message- From: "Lehr, Theodore" Date: Tue, 23 Feb 2010 10:21:26 To: nat.

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 11:04 AM, Keith Reinfeld wrote: > > I presume my removeEventListener works. > You should be sure. So check it: > > trace(e.currentTarget.hasEventListener(Event.COMPLETE)); //true > e.currentTarget.removeEventListener(Event.COMPLETE, loaded); > trace(e.currentTarget.hasEvent

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Geografiek
Hi Theodore, var mySprite:Sprite; Do this: function createBar(dfile:String):void { ... mySprite = new Sprite(); function createGraph():void { mySprite.graphics. addChild(mySprite); } } You declared mySprite ins

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
> private function handleTcpData(event:Event):void { >while (_socket.bytesAvailable) { > var str:String = _socket.readUTF(); > updateGUI(str); >} > } maybe you shouldn't ignore thrown errors: AFAIK if the UTF8-data is not complete (ie.. the last UTF-8 byte sequence is truncate

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread tom rhodes
you could also make createBar return a reference to the sprite... function createBar(dfile:String):Sprite { ... mySprite = new Sprite(); // do stuff addChild(mySprite); return mySprite; } var mySprite:Sprite = createBar("string"); then you can remove it us

[Flashcoders] Error 1009

2010-02-23 Thread Victor Subervi
Hi; I have a preloader that (obviously) calls another swf onload. This other swf loads by itself with no problem; however, it calls another script and apparently this is what's throwing the error. Curtis Morley says I should add that other script to the first frame of a timeline and set the alpha

Re: [Flashcoders] Error 1009

2010-02-23 Thread Henrik Andersson
Victor Subervi wrote: Hi; I have a preloader that (obviously) calls another swf onload. This other swf loads by itself with no problem; however, it calls another script and apparently this is what's throwing the error. What error? Use the debugger and find out! _

Re: [Flashcoders] Error 1009

2010-02-23 Thread Glen Pike
Are you "listening" for Event.INIT or Event.COMPLETE for your preloader? You should possibly use the former to make sure all your child clips are instanciated before you run AS3 code that accesses these child clips. Victor Subervi wrote: Hi; I have a preloader that (obviously) calls another

[Flashcoders] Class Property vs. Static Property?

2010-02-23 Thread Jer Brand
This feels like a really stupid question, but it's stuck in my head: http://gskinner.com/talks/quickNL/#44 On that slide (slide 44) he references access speed for "Literal", "Local", "Instance", "Static" and "Class" properties. Apparently my OOP terminology is bleeding together here, but what's t

Re: [Flashcoders] Class Property vs. Static Property?

2010-02-23 Thread Mark Winterhalder
I'm just guessing here, but maybe he's referring to properties of the prototype Object? Because, I don't see it on the list. Then again, I would expect access to instance properties to be faster, based on the assumption that they take precedence. I guess somebody will have to recreate the test and

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
thanks for all of the help... I did resolve it by taking the functions out of the other functions... and creating the sprite at the root (outside of the functions) t From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Lehr, Theodore
So here is my next issue... One of the functions creates a dynamic amount sprites based on an xml feed, like so function createBars():void { for (var i:int=0; ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] accessing event dispatchers in a loosely-coupled, modular design

2010-02-23 Thread Andrew Sinning
In other words: Create a Controller class before creating any other classes. Any instances that need to know when potential event dispatchers are created should listen to the Controller class. When dispatchers are created, the Controller class should dispatch an event. This way I

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Keith Reinfeld
You could parent them. Var barMom:Sprite = new Sprite(); addChild(barMom); function createBars():void { for (var i:int=0; ihttp://keithreinfeld.home.comcast.net > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- > boun...@chattyfig.figleaf.co

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Glen Pike
bar.name = "bar_" + i; function destroyBars():void { for (var i:int=0; i So here is my next issue... One of the functions creates a dynamic amount sprites based on an xml feed, like so function createBars():void { for (var i:int=0; ihttp://chattyfig.figleaf.com/mailman/listinfo/f

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Lehr, Theodore
Thanks man - that did it From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith Reinfeld [keithreinf...@comcast.net] Sent: Tuesday, February 23, 2010 12:10 PM To: 'Flash Coders List' Subject: RE:

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread tom rhodes
ok, bar isn't the name of the sprite, it's a variable with name bar which contains a reference to your sprite... if you want to use names then do something like bar.name = String("bar_" + i); but personally i'd use an array like so... var bars:Array = []; function createBars():void { for (var

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Henrik Andersson
Lehr, Theodore wrote: Any ideas? Store a reference to each object in a vector like this: var bars:Vector.=new Vector.(); function createBars():void { for (var i:int=0; ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders

RE: [Flashcoders] accessing event dispatchers in a loosely-coupled, modular design

2010-02-23 Thread Merrill, Jason
Sort of - but I wouldn't have the controller dispatch anything. I would only have it listen to the view(s) (your other classes with a visual presence). The controller first creates an instance of "A" (what determines when that happens, I don't know because I don't know what "A" or your app is all

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Geografiek
You could create an empty array (outside the functions) And add each newly created bar to the array. Afterwards, say in another function, you can reference the array indexes. Something like: myBarsArray = new Array(); function createBars():void { for (var i:int=0; iSo here is my next issu

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Nathan Mynarcik
Inside your loop, you can add the sprite to a movieclip and give each movieclip a name using the variable in your loop like: mcName.name = "mc"+i; //or whatever your for loop var is And then remove it by getChildByName(mc#); --Original Message-- From: Lehr, Theodore Sender: flashcoders

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> How is that? I'm not iterating over that function, I call it as needed, > so > myX, myY would be reset every time. Uses the addition assignment (+=) operator. > No: > displayObject.filters = [createBevel()]; You are missing the point. Why run this function repeatedly when you can set 'myBeve

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Lehr, Theodore
A peculair twist now is that these bar sprites are being sent to the back (meaning I have other sprites - lines) showing on top when they were and should showing in the back... imagine if you will a bar chart - that has horizontal lines in the back... these lines now show on top of the bars... a

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Merrill, Jason
I agree with Mr. Tom Rhodes. Storing references to your "buttons" in an array is far better than trying to create and use "dynamic" instance names like "bar"+i. You can tack on data properties to the buttons as well, so they have information about themselves that travels with them. Jason Merril

Re: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Kerry Thompson
Theodore Lehr wrote: > thanks for all of the help... I did resolve it by taking the functions out of > the other functions... and creating the sprite at the root (outside of the > functions) Glad you got it fixed. I'm late to the discussion, so didn't contribute anything yet--but I will now :-)

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Glen Pike
I think it depends on the circumstances: If you are not manipulating the child sprites in any way, just adding them at the start, removing at the end and possibly listening for events on them, why would you want to use more memory by storing the sprite instances in an array or a vector when yo

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Keith Reinfeld
addChildAt(child:DisplayObject, index:int) So: this.addChildAt(barMom, 0); Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- > boun...@chattyfig.figleaf.com] On Behalf

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Nathan Mynarcik
You can use the addChildAt method and tell it where to add the object in the displaylist. addChildAt(objectName, 0); will add the objectName to the bottom of the display list. Nathan Mynarcik Interactive Web Developer nat...@mynarcik.com 254.749.2525 www.mynarcik.com -Original Message--

RE: [Flashcoders] Finding and Removing a Sprite

2010-02-23 Thread Lehr, Theodore
awesome - thanks From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kerry Thompson [al...@cyberiantiger.biz] Sent: Tuesday, February 23, 2010 12:36 PM To: Flash Coders List Subject: Re: [Flashcoder

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Merrill, Jason
IMO, an array is hardly a waste of space, and allows for expanding your app easier if need be, but you're right, could come down to coding preferences in that case. More often though I think, the benefits of storing them in an array outweigh the benefits of dynamic naming. Jason Merrill Bank o

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 1:27 PM, Keith Reinfeld wrote: > > How is that? I'm not iterating over that function, I call it as needed, > > so > > myX, myY would be reset every time. > > Uses the addition assignment (+=) operator. > My bad. It is not iteration. It is called onMouseOver, hence the valu

[Flashcoders] removeChild Question

2010-02-23 Thread Susan Day
Hi; How do I determine what the parent object is of a child I have added and want to remove? TIA, Susan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Mark Winterhalder
On Tue, Feb 23, 2010 at 6:43 PM, Glen Pike wrote: > why would you want to use more memory by storing the sprite instances in an > array or a vector when you already have a storage medium for them - the > parent container? We're talking about only nine instances here. It would be a different matte

Re: [Flashcoders] removeChild Question

2010-02-23 Thread Henrik Andersson
Susan Day wrote: Hi; How do I determine what the parent object is of a child I have added and want to remove? Usually, there is only one possible candidate and you know what that one is ahead of time. But there is an embarrassingly simple way: the parent property. ___

Re: [Flashcoders] Error 1009

2010-02-23 Thread Victor Subervi
On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike wrote: > Are you "listening" for Event.INIT or Event.COMPLETE for your preloader? > You should possibly use the former to make sure all your child clips are > instanciated before you run AS3 code that accesses these child clips. > Yes. I changed COMPLE

Re: [Flashcoders] Error 1009

2010-02-23 Thread Henrik Andersson
Victor Subervi wrote: For Hendrik, I am currently downloading the debugger. It's big! Eh? The content debugging player is only marginally bigger than the normal player. It is smaller than some movies. Then again, you need a debugger for the player to connect to. It is integrated in all seri

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Keith Reinfeld
More than one way to get things done. Depends on your needs. Check out DisplayObjectContainer in the docs. var barMom:Sprite = new Sprite(); this.addChildAt(barMom, 0); function createBars():void { for (var i:int=0; i < 9; i++) { var bar:Sprite = new Sprite();

[Flashcoders] Line graph tutorial

2010-02-23 Thread Lehr, Theodore
Anyone know of any goods examples of how to do a line graph using xml data? I am looking through google now... ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

RE: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread Merrill, Jason
>> Doesn't storing them in an array create a set of references that will need to be cleaned up? Absolutely (if the app performance even needs cleaning up and/or the items are even removed). But that's easily taken care of with a cleanup function. So for small uses, as I mentioned, may not be wor

[Flashcoders] Is Object.registerClass still needed with attachMovie?

2010-02-23 Thread Jim Lafser
I was using Flash CS3 and it seemed like I needed to use Object.registerClass to get a movie clip that I attached wrapped in my class. Seemed like the class identifier in the library did not work. Now I'm using CS4 and it looks like the class identifier in the library does work. Was I just mista

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
When loading bitmaps, your loader will NEVER be eligible for cleanup by the Garbage Collector unless you do ALL of the following in this order: var bitmap:Bitmap = new Bitmap(Bitmap(loader.content).bitmapData.clone(), "auto", true); Bitmap(loader.content).bitmapData.dispose(); loader.unloadAnd

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
You should only create the bevel filter ONCE. Filters are _expensive_ and can/should be shared. Make your bevel an instance variable private var myBevel:BevelFilter = new BevelFilter(); public function foo() { myClip.filters = [myBevel]; } ___ F

[Flashcoders] Using parent Sprites coordinates

2010-02-23 Thread Lehr, Theodore
Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: var bgDad:Sprite = new Sprite(); then I add a child: var bgSon:Sprite = new Sprite(); bgSon.graphics.lineStyle(1,0x00); bgSon.graphics.moveTo(0,0); bgSon.graphics.lineTo(100

Re: [Flashcoders] Finding and Removing a Sprite: PART II

2010-02-23 Thread tom rhodes
yeah, horses for courses... if you want to better encapsulate stuff, i find it easier to work with arrays (in fp10 vectors) and pass them around if needs be. tying your code to specific timelines gives you more work to do if you want to reuse that code imho. for something quick and dirty in timel

Re: [Flashcoders] Using parent Sprites coordinates

2010-02-23 Thread Henrik Andersson
Lehr, Theodore wrote: Is there a way to have a child sprite reference the parent sprite when seeting it's x and y say I have a Sprite: You must have missed localToGlobal and globalToLocal. ___ Flashcoders mailing list Flashcoders@chattyfig.figle

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Karl DeSaulniers
There is Quickoffice and QuickAccess. I helped them with some product demos in the past. I believe their iphone app can access their system app via wifi. So I am sure you could find some how to do the same. Karl On Feb 23, 2010, at 7:11 AM, Eric E. Dolecki wrote: I'm curious - has anyone seen a

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
I've come up with this, but still have a flaw there: private function handleTcpData(event:Event):void { var len:uint; if (0 == _socket.bytesAvailable) return; try { _socket.readBytes(_ba, _ba.bytesAvailable, _socket

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Eric E. Dolecki
That's what I am after - no clear idea (yet) On Tue, Feb 23, 2010 at 4:13 PM, Karl DeSaulniers wrote: > There is Quickoffice and QuickAccess. > I helped them with some product demos in the past. > I believe their iphone app can access their system app via wifi. > So I am sure you could find some

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
I've added some traces there and see that this doesn't work: if (_ba.bytesAvailable >= len) { var str:String = _ba.readUTFBytes(len); updateGUI(str); // copy the remaining bytes

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Karl DeSaulniers
If I was In your position, I would go buy the quickaccess app and deconstruct it. Might give you tips. Plus you may need a jailbroken iPhone as well to fish for the app files. I did something similar with the katra weather lock screen. But I talked one on one with the developer to get tips

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
Steven, Thanks for the backup. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- > boun...@chattyfig.figleaf.com] On Behalf Of Steven Sacks > Sent: Tuesday, February 23,

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Karl DeSaulniers
Btw. I am not suggesting to steal anyones code. Just figure out the idea and then create your own. Karl Sent from losPhone On Feb 23, 2010, at 3:38 PM, "Eric E. Dolecki" wrote: That's what I am after - no clear idea (yet) On Tue, Feb 23, 2010 at 4:13 PM, Karl DeSaulniers >wrote: The

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Eric E. Dolecki
I think I need an iphone app that connects to a socket server running on the mac. Then a mac app. ugh. On Tue, Feb 23, 2010 at 4:53 PM, Karl DeSaulniers wrote: > If I was In your position, I would go buy the quickaccess app and > deconstruct it. Might give you tips. > > Plus you may need a jailb

RE: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Keith Reinfeld
> > var bitmap:Bitmap = new > Bitmap(Bitmap(loader.content).bitmapData.clone(),"auto", true); > Bitmap(loader.content).bitmapData.dispose(); > loader.unloadAndStop(true); > try { > loader.close(); > } catch (e:Error) {} > // remove all event listeners from loader > Steven, I'm curious about

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Paul Andrews
Eric E. Dolecki wrote: I think I need an iphone app that connects to a socket server running on the mac. Then a mac app. ugh. Surely any socket server on any machine would do? On Tue, Feb 23, 2010 at 4:53 PM, Karl DeSaulniers wrote: If I was In your position, I would go buy the quickac

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
Alexander Farber wrote: > I've come up with this, but still have a flaw there: > > private function handleTcpData(event:Event):void { > var len:uint; what about this simple alternative: private function handleTcpData(event:Event):void { if(_socket.bytesAvailable) { try{ var str

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Karl DeSaulniers
Yeah you will have to build both I believe. Look at http://www.hackint0sh.org/f9/ You might wiggle your way into some information. Karl On Feb 23, 2010, at 4:00 PM, Eric E. Dolecki wrote: I think I need an iphone app that connects to a socket server running on the mac. Then a mac app. ugh.

Re: [Flashcoders] Flash app talking to iPhone app over wifi

2010-02-23 Thread Karl DeSaulniers
Here is the link for Quickaccess. http://www.quickaccess.net/downloads/ Karl On Feb 23, 2010, at 4:00 PM, Eric E. Dolecki wrote: I think I need an iphone app that connects to a socket server running on the mac. Then a mac app. ugh. On Tue, Feb 23, 2010 at 4:53 PM, Karl DeSaulniers wrote

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
Yes, that's with what I had started and what doesn't work :-) On Tue, Feb 23, 2010 at 11:17 PM, Valentin Schmidt wrote: > private function handleTcpData(event:Event):void { >  if(_socket.bytesAvailable) { >    try{ >      var str:String = _socket.readUTF(); >      updateGUI(str); >    }catch(e:Er

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
Alexander Farber wrote: > Yes, that's with what I had started and what doesn't work :-) so then why did you start with posting code here (pasted below) that didn't contain any exception catching? that's the crucial point: you have to catch the exception, otherwise you would either get corrupted UT

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
some comments added to make it easier for you to spot the differences :-) private function handleTcpData(event:Event):void { if(_socket.bytesAvailable) { // USE IF, NOT WHILE! try{ // CATCH THE EXCEPTION var str:String = _socket.readUTF(); updateGUI(str); }catch(e:Error){}

Re: [Flashcoders] accessing event dispatchers in a loosely-coupled, modular design

2010-02-23 Thread Allandt Bik-Elliott (Receptacle)
aside from the advice that i got on this message list, i found this article from adobe really useful http://www.adobe.com/devnet/flex/articles/blueprint.html might help here too best a On 23 Feb 2010, at 17:19, Merrill, Jason wrote: Sort of - but I wouldn't have the controller dispatch any

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
Hello Valentin, On Wed, Feb 24, 2010 at 12:06 AM, Valentin Schmidt wrote: > so then why did you start with posting code here (pasted below) that > didn't contain any exception catching? that's the crucial point: you > have to catch the exception, otherwise you would either get corrupted > UTF str

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
> And if you use an "if" instead of "while", > then you lose even more incoming data. how come? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

[Flashcoders] How to remove bytes from the beginning of a ByteArray?

2010-02-23 Thread Alexander Farber
Hello, sorry, but I'll try to start another thread to explain my problem. I read data from a socket into a ByteArray _ba and keep inspecting it. When there is enough data, I'd like to extract and process it and remove the processed bytes from the _ba. Here is how I try to do the removal, but it

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
On Wed, Feb 24, 2010 at 12:36 AM, Valentin Schmidt wrote: >> And if you use an "if" instead of "while", >> then you lose even more incoming data. > > how come? Ok, here your suggestion again: private function handleTcpData(event:Event):void { if(_socket.bytesAvailable) { // USE IF, NOT WHILE!

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Alexander Farber
After some thought... the 2nd case (not enough data arrived) is not a problem for your code, because the handleTcpData() will get called again - once the rest of the data arrived. But for the 1st case (several UTF strings arrived at once)... Maybe I should try the following (and don't need a ByteA

Re: [Flashcoders] bytesAvailable, readUTF() and ProgressEvent.SOCKET_DATA

2010-02-23 Thread Valentin Schmidt
Alexander Farber wrote: > After some thought... the 2nd case (not enough data arrived) > is not a problem for your code, because the handleTcpData() > will get called again - once the rest of the data arrived. > > But for the 1st case (several UTF strings arrived at once)... > Maybe I should try t

Re: [Flashcoders] Error 1009

2010-02-23 Thread Deepanjan Das
Hey, I have not seen your debugger error. but I feel its the stage that is getting null value. Please trace stage to find out. Let me know. Cheers Deepanjan Das On Tue, Feb 23, 2010 at 11:45 PM, Victor Subervi wrote: > On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike >wrote: > > > Are you "listeni

Re: [Flashcoders] How to remove bytes from the beginning of a ByteArray?

2010-02-23 Thread Juan Pablo Califano
Hi, You've got the source / destination backwards. readBytes reads *from* the object on which the method is called. And it writes *to* the ByteArray you pass in the first parameter. So this: var newBA:ByteArray = new ByteArray(); newBA.readBytes(_ba); _ba = newBA; Is copying data *from* newBA

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Steven Sacks
If you call close() on a Loader and it fails for any reason, it will throw a runtime error that you can do nothing about. To avoid this, you should wrap it in a try catch. The code block comes straight from Flex and it works. If you test it a bunch and close() never fires an error, then you ca

Re: [Flashcoders] How to remove bytes from the beginning of a ByteArray?

2010-02-23 Thread Steven Sacks
FWIW, flush() does nothing in AS3. Bytes written to the Socket are sent immediately. Anyone who tells you otherwise has never tested it and you can safely ignore them! :) Adobe has acknowledged this as a documentation bug (whatever that means). For more info: http://www.stevensacks.net/20

Re: [Flashcoders] How to remove bytes from the beginning of a ByteArray?

2010-02-23 Thread Steven Sacks
private var buffer:ByteArray; private function onData(event:ProgressEvent):void { socket.readBytes(buffer, buffer.length); var bytes:ByteArray = new ByteArray(); buffer.readBytes(bytes, 0, messageLength); buffer.position = bytes.length; trim(); // deserialize the message i