[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 =

[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

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

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

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

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

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

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

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 he...@henke37.cjb.net 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

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

[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

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:

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

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

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 call

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:

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 ted_l...@federal.dell.com Date: Tue, 23 Feb

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 11:04 AM, Keith Reinfeld keithreinf...@comcast.netwrote: 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);

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

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 truncated),

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

[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 the

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

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

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; itotalbars; i++) { var bar:Sprite = new Sprite(); ... addChild(bar); {

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; itotalbars; i++) { var bar:Sprite = new Sprite(); bar.name = barBrat+i; ... barMom.addChild(bar);

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; itotalbars; i++) { var bar:Sprite = getChildByName(bar_ +i) as Sprite; if(bar) { ... removeChild(bar); } } } Lehr, Theodore wrote: So here is my next

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: [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.Bar=new Vector.Bar(); function createBars():void { for (var i:int=0; itotalbars; i++) { var bar:Bar = new Bar(); ...

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; itotalbars; i++) {

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:

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 'myBevel'

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...

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 Merrill

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

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 Of

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

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:

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

Re: [Flashcoders] Event.COMPLETE Question

2010-02-23 Thread Susan Day
On Tue, Feb 23, 2010 at 1:27 PM, Keith Reinfeld keithreinf...@comcast.netwrote: 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

[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 g...@engineeredarts.co.uk 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

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 g...@engineeredarts.co.ukwrote: 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.

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

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

[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

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();

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]; } ___

[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);

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

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

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

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,

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 k...@designdrumm.comwrote: 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

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 edole...@gmail.com wrote: That's what I am after - no clear idea (yet) On Tue, Feb 23, 2010 at 4:13 PM, Karl

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 k...@designdrumm.comwrote: If I was In your position, I would go buy the quickaccess app and deconstruct it. Might give you tips. Plus you

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 the

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 k...@designdrumm.comwrote: If I was In your position, I

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

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

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 v...@dasdeck.com wrote: private function handleTcpData(event:Event):void {  if(_socket.bytesAvailable) {    try{      var str:String = _socket.readUTF();      updateGUI(str);    

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

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

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 v...@dasdeck.com 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

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 v...@dasdeck.com 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

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

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 the

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 victorsube...@gmail.comwrote: On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike

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

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:

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