Re: [Flashcoders] best way to perform collision detection on rigid objects?
Hi, I haven't dig into 3D, but recently I've found this blog post about 3D collisions. http://papergem.wordpress.com/2009/02/13/3d-collisions-basics/ Cheers Juan Pablo Califano 2009/2/28, Anthony Pace anthony.p...@utoronto.ca: For 2d I would assume a xor for the solid object created by a shape created by the displacement of object1 in the next frame and the object1 in the current frame to detect if a collision occurs between it and object2? For 3d spherical subdivision mixed with 6 sided bitmap xor in the same respect? Or would this be too expensive cycle wise? ___ 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] InputTextField issue
Hi, I'm almost certain that tabIndex is 1-based not 0-based, so it should be: txtName.tabIndex = 1; txtEmail.tabIndex = 2; txtAddress.tabIndex = 3; txtCity.tabIndex = 4; Also, Cor, when testing inside the IDE, you should check disable keyboard shortchuts in the control menu; otherwise, the IDE will trap the many of the key presses. Cheers Juan Pablo Califano 2009/2/28, Gerry noentour...@gmail.com: You can look up focus (stage.focus = txtName; ), that will allow you to set which textfield has focus and for tabbing use tabIndex like this. txtName.tabIndex = 0; txtEmail.tabIndex = 1; txtAddress.tabIndex = 2; txtCity.tabIndex = 3; -Gerry On Feb 28, 2009, at 3:19 AM, Cor wrote: Hi Keith, I think I have put it wrong in my question. When running in the IDE is discards several, like: q,e,r,t, but the w is accepted. When I run in in html it accepts nothing. But in both cases when I first click the textfield the give it the focus it works as expected. So my problem really is: How to give the textfield the focus on start? And additional when I have a second textfield, how can I make is change from one to the other using the TAB key? Kind regards Cor ___ 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] InputTextField issue
Thanks Juan! I am still not able to set the focus to the input textfield on opening. Any ideas? Kind regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Juan Pablo Califano Sent: zondag 1 maart 2009 13:53 To: Flash Coders List Subject: Re: [Flashcoders] InputTextField issue Hi, I'm almost certain that tabIndex is 1-based not 0-based, so it should be: txtName.tabIndex = 1; txtEmail.tabIndex = 2; txtAddress.tabIndex = 3; txtCity.tabIndex = 4; Also, Cor, when testing inside the IDE, you should check disable keyboard shortchuts in the control menu; otherwise, the IDE will trap the many of the key presses. Cheers Juan Pablo Califano 2009/2/28, Gerry noentour...@gmail.com: You can look up focus (stage.focus = txtName; ), that will allow you to set which textfield has focus and for tabbing use tabIndex like this. txtName.tabIndex = 0; txtEmail.tabIndex = 1; txtAddress.tabIndex = 2; txtCity.tabIndex = 3; -Gerry On Feb 28, 2009, at 3:19 AM, Cor wrote: Hi Keith, I think I have put it wrong in my question. When running in the IDE is discards several, like: q,e,r,t, but the w is accepted. When I run in in html it accepts nothing. But in both cases when I first click the textfield the give it the focus it works as expected. So my problem really is: How to give the textfield the focus on start? And additional when I have a second textfield, how can I make is change from one to the other using the TAB key? Kind regards Cor ___ 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.4/1976 - Release Date: 02/28/09 17:21:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] InputTextField issue
Cor, first, bear in mind this is a gross hack, but I haven't found another way around yet (if someone has found a more elegant way, please share!). This is a solution (well, sort of) I came across when I had to deal with a very similar problem. In the IDE, the textfield actually gains focus, but the caret doesn't show up; so, from a user perspective, it's like it doesn't have focus, I guess (in fact, it could be counter intuitive for the user; you expect a caret to signal that a text field has focus...) Plus, in the browser, you don't gain focus immediately. You could register to FOCUS_IN on the stage or even Event.ACTIVATE to detect when the swf gets focus, but for some reason I just can't understand (a bug in the player or maybe I'm missing something), it just doesn't seem to work. Basically, your swf will gain focus when the user clicks on it. (I think it will also gain focus if you tab to it, but I haven't covered that...) So, when the user clicks down for the first time, you can reasonably assume your swf has gain focus. So, what you could do is this: In your constructor stage.addEventListener(MouseEvent.MOUSE_DOWN,handleStageMouseDown); And then private function handleStageMouseDown(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_DOWN,handleStageMouseDown); stage.focus = inputTextField; } Ugly and probably limited, but it has worked for me. Hope it works for you! Cheers Juan Pablo Califano 2009/3/1, Cor c...@chello.nl: Thanks Juan! I am still not able to set the focus to the input textfield on opening. Any ideas? Kind regards Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Juan Pablo Califano Sent: zondag 1 maart 2009 13:53 To: Flash Coders List Subject: Re: [Flashcoders] InputTextField issue Hi, I'm almost certain that tabIndex is 1-based not 0-based, so it should be: txtName.tabIndex = 1; txtEmail.tabIndex = 2; txtAddress.tabIndex = 3; txtCity.tabIndex = 4; Also, Cor, when testing inside the IDE, you should check disable keyboard shortchuts in the control menu; otherwise, the IDE will trap the many of the key presses. Cheers Juan Pablo Califano 2009/2/28, Gerry noentour...@gmail.com: You can look up focus (stage.focus = txtName; ), that will allow you to set which textfield has focus and for tabbing use tabIndex like this. txtName.tabIndex = 0; txtEmail.tabIndex = 1; txtAddress.tabIndex = 2; txtCity.tabIndex = 3; -Gerry On Feb 28, 2009, at 3:19 AM, Cor wrote: Hi Keith, I think I have put it wrong in my question. When running in the IDE is discards several, like: q,e,r,t, but the w is accepted. When I run in in html it accepts nothing. But in both cases when I first click the textfield the give it the focus it works as expected. So my problem really is: How to give the textfield the focus on start? And additional when I have a second textfield, how can I make is change from one to the other using the TAB key? Kind regards Cor ___ 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.4/1976 - Release Date: 02/28/09 17:21:00 ___ 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] Duplicate Bitmap and scale question
Hi Please explain what is wrong in this code: function duplicateMovieClipImage(from:MovieClip, target:MovieClip){ var visuals = new flash.display.BitmapData(from._width, from._height); visuals.draw(from); target.attachBitmap(visuals, 1,auto,true); } duplicateMovieClipImage(mc,img) img._xscale=50; img._yscale=50; duplicateMovieClipImage(img,img2) I expected that img1 and img2 have the same scale. Instead of that img2 show 50% of mc. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] InputTextField issue
This is true. I started with 0 which is incorrect, I've been working with Arrays this week so a 0 index slipped in there. -Gerry On Mar 1, 2009, at 7:53 AM, Juan Pablo Califano wrote: Hi, I'm almost certain that tabIndex is 1-based not 0-based, so it should be: txtName.tabIndex = 1; txtEmail.tabIndex = 2; txtAddress.tabIndex = 3; txtCity.tabIndex = 4; Also, Cor, when testing inside the IDE, you should check disable keyboard shortchuts in the control menu; otherwise, the IDE will trap the many of the key presses. Cheers Juan Pablo Califano 2009/2/28, Gerry noentour...@gmail.com: You can look up focus (stage.focus = txtName; ), that will allow you to set which textfield has focus and for tabbing use tabIndex like this. txtName.tabIndex = 0; txtEmail.tabIndex = 1; txtAddress.tabIndex = 2; txtCity.tabIndex = 3; -Gerry On Feb 28, 2009, at 3:19 AM, Cor wrote: Hi Keith, I think I have put it wrong in my question. When running in the IDE is discards several, like: q,e,r,t, but the w is accepted. When I run in in html it accepts nothing. But in both cases when I first click the textfield the give it the focus it works as expected. So my problem really is: How to give the textfield the focus on start? And additional when I have a second textfield, how can I make is change from one to the other using the TAB key? Kind regards Cor ___ 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] InputTextField issue
Juan, Thanks, I had made the exact same this workaround but with MOUSE_MOVE: stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); function mouseMoved (e:MouseEvent) :void{ stage.focus = inputTextField; stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); } But still nothing happing when I run it in html Cor ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] InputTextField issue
Juan, My mouse move did not work and your mouse down does work! But the problem is still there, the user HAS to click. Thanks!! Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: zondag 1 maart 2009 16:26 To: 'Flash Coders List' Subject: RE: [Flashcoders] InputTextField issue Juan, Thanks, I had made the exact same this workaround but with MOUSE_MOVE: stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); function mouseMoved (e:MouseEvent) :void{ stage.focus = inputTextField; stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); } But still nothing happing when I run it in html Cor ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.4/1976 - Release Date: 02/28/09 17:21:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] InputTextField issue
This one has bitten me many times, so that's why I remember it! Anyway, it would make more sense to start with 0, since almost everything else (arrays, string indexes) is 0 based. Cheers Juan Pablo Califano 2009/3/1, Gerry noentour...@gmail.com: This is true. I started with 0 which is incorrect, I've been working with Arrays this week so a 0 index slipped in there. -Gerry On Mar 1, 2009, at 7:53 AM, Juan Pablo Califano wrote: Hi, I'm almost certain that tabIndex is 1-based not 0-based, so it should be: txtName.tabIndex = 1; txtEmail.tabIndex = 2; txtAddress.tabIndex = 3; txtCity.tabIndex = 4; Also, Cor, when testing inside the IDE, you should check disable keyboard shortchuts in the control menu; otherwise, the IDE will trap the many of the key presses. Cheers Juan Pablo Califano 2009/2/28, Gerry noentour...@gmail.com: You can look up focus (stage.focus = txtName; ), that will allow you to set which textfield has focus and for tabbing use tabIndex like this. txtName.tabIndex = 0; txtEmail.tabIndex = 1; txtAddress.tabIndex = 2; txtCity.tabIndex = 3; -Gerry On Feb 28, 2009, at 3:19 AM, Cor wrote: Hi Keith, I think I have put it wrong in my question. When running in the IDE is discards several, like: q,e,r,t, but the w is accepted. When I run in in html it accepts nothing. But in both cases when I first click the textfield the give it the focus it works as expected. So my problem really is: How to give the textfield the focus on start? And additional when I have a second textfield, how can I make is change from one to the other using the TAB key? Kind regards Cor ___ 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 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] MVC(S) Question
Hi Dr Ache, Yes - the state machine idea was something I had for a kind of screen manager class to transition between the screens - View1 View2 below. My screens contain 1 or more views depending on how complex the views are (trying to break stuff down), but to keep the loose coupling between views and controllers, I was trying to find a way of setting controllers on a view in a more dynamic way because I was using Events to communicate between view and controller and wanted to hookup the appropriate controller for it's corresponding events, e.g. View1: (Do I put Button1 Slider1 in their own view? - not just for 2 components, maybe for many components with the same controller) Button1 (Plays music on the Jukebox device) Slider1 (changes volume on the Jukebox) Button2 (Plays video on the VideoPlayer device) Slider2 (changes colour on Lighting device #1) View2: Sliders 1 - 4 (Lighting devices #1-#4) Controller Models: Jukebox VideoPlayer Lighting:Array = [Light #1, ...] So being as my various buttons are linked up to different device instances, rather than wiring the controller into the individual buttons directly - my view still needs some control over the functionality of buttons under different circumstances - I wanted to wire the controllers up to the view. As the things being controlled, hence controllers don't change for each screen, just what controls are exposed, I wanted to create an API to attach my controllers in a more abstract way, which is why I thought about interrogating the controllers for the events they want - then they become more pluggable like the views... Hope this helps explain my ideas a bit more.. Thanks Glen dr.ache wrote: Wait..i cannot really follow you ;-) Just a guess: Try to implement a state machine with transitions between those states. Your states have IDs and so the transitions do. Whenever you transition IN a new state you can setup your controller, show your views and so forth. I expect you to have some kind of a rule, when each view in combination with others is shown, right? Or do they popup individually every time? Glen Pike schrieb: Hi, Thanks for your answer. I like the idea of loose coupling very much and the speed issue is important, but like you said, I need to test this out really. I still have an issue with how to do the layout of my M's, V's C's because like I mentioned, my application Screens compose Views for various associated Controllers/Models and the screens are essentially what the application shows and switches between... I am thinking that because there are fairly fixed controllers + models in my application (to start with) these pairs should be somehow handled by the application. Because of loose-coupling there being screens with many views in, I don't think my controllers should be creating the individual view - there are a number of different views utilising a single controller so how does the controller know what to create? I am thinking about allowing the Application to some how wire in the controllers to my Screens - the composite of Views - dynamically and somehow allow this to wire up my event listeners according to what events the controller(s) respond to. I don't know if this is a bad thing, so any critique is welcome, but my idea is somehow to implent the following: IController::whatEventsDoYouHandle() ICompositeView::addController(control:IController) { var desired:Array = control.whatEventsDoYouHandle(); for each(evt in desired) { addEventListener(evt.type, evt.func...) } } Apart from making sure I remove all listeners, is this a sensible way of utilising the same controllers models - for my same devices whilst just changing the button screens which interact with the devices??? When my system adds another device, I can add appropriate controllers and models then create my new screen(s) to utilise these as desired?? Any suggestions caveats, etc. Glen dr.ache wrote: Hi Glen. I would defenitively go with lose coupling and one controller by one device. You mentioned one requirement being the scaleability what new views are concerned - so there is no others choice. To proof the speed of that setup you need to implement a prototype of a likely application state. How should someone else know? But as a general tip: Always go with the better architecture - the speed comes with better hardware (or flash player). Glen Pike schrieb: Hi, I am reworking an application we use for a touchscreen interface and am trying to design the architecture for all the right reasons. I am currently wrangled in MVC-ness and trying to work out the best way to move forward. Having immersed myself in many books and texts, I still find myself going around in circles some of the time and would like to make some choices with possible help from you guys... The app talks to a back
Re: [Flashcoders] InputTextField issue
True, but it think the user will have to click somewhere in the swf anyway to begin interacting with it, because when the swf loads in the html, it doesn't have focus (unless it tabs to the swf). Maybe you could try to force focus on the swf with javascript... Cheers Juan Pablo Califano 2009/3/1, Cor c...@chello.nl: Juan, My mouse move did not work and your mouse down does work! But the problem is still there, the user HAS to click. Thanks!! Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Cor Sent: zondag 1 maart 2009 16:26 To: 'Flash Coders List' Subject: RE: [Flashcoders] InputTextField issue Juan, Thanks, I had made the exact same this workaround but with MOUSE_MOVE: stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); function mouseMoved (e:MouseEvent) :void{ stage.focus = inputTextField; stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoved); } But still nothing happing when I run it in html Cor ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.4/1976 - Release Date: 02/28/09 17:21:00 ___ 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] MVC(S) Question
Hi Glen. Normally you can/should combine UI elements logically together. Your ui elements for the video player, the ones for the jukebox etc.There is no need for an individual controller for every button. To emphasize the state machine again you can enable/disable controllers during state transition. so why do you want to wire things differently in each view? And yes, stick with events when you build your app, even if you might know, that there is only on controller for the view. Glen Pike schrieb: Hi Dr Ache, Yes - the state machine idea was something I had for a kind of screen manager class to transition between the screens - View1 View2 below. My screens contain 1 or more views depending on how complex the views are (trying to break stuff down), but to keep the loose coupling between views and controllers, I was trying to find a way of setting controllers on a view in a more dynamic way because I was using Events to communicate between view and controller and wanted to hookup the appropriate controller for it's corresponding events, e.g. View1: (Do I put Button1 Slider1 in their own view? - not just for 2 components, maybe for many components with the same controller) Button1 (Plays music on the Jukebox device) Slider1 (changes volume on the Jukebox) Button2 (Plays video on the VideoPlayer device) Slider2 (changes colour on Lighting device #1) View2: Sliders 1 - 4 (Lighting devices #1-#4) Controller Models: Jukebox VideoPlayer Lighting:Array = [Light #1, ...] So being as my various buttons are linked up to different device instances, rather than wiring the controller into the individual buttons directly - my view still needs some control over the functionality of buttons under different circumstances - I wanted to wire the controllers up to the view. As the things being controlled, hence controllers don't change for each screen, just what controls are exposed, I wanted to create an API to attach my controllers in a more abstract way, which is why I thought about interrogating the controllers for the events they want - then they become more pluggable like the views... Hope this helps explain my ideas a bit more.. Thanks Glen dr.ache wrote: Wait..i cannot really follow you ;-) Just a guess: Try to implement a state machine with transitions between those states. Your states have IDs and so the transitions do. Whenever you transition IN a new state you can setup your controller, show your views and so forth. I expect you to have some kind of a rule, when each view in combination with others is shown, right? Or do they popup individually every time? Glen Pike schrieb: Hi, Thanks for your answer. I like the idea of loose coupling very much and the speed issue is important, but like you said, I need to test this out really. I still have an issue with how to do the layout of my M's, V's C's because like I mentioned, my application Screens compose Views for various associated Controllers/Models and the screens are essentially what the application shows and switches between... I am thinking that because there are fairly fixed controllers + models in my application (to start with) these pairs should be somehow handled by the application. Because of loose-coupling there being screens with many views in, I don't think my controllers should be creating the individual view - there are a number of different views utilising a single controller so how does the controller know what to create? I am thinking about allowing the Application to some how wire in the controllers to my Screens - the composite of Views - dynamically and somehow allow this to wire up my event listeners according to what events the controller(s) respond to. I don't know if this is a bad thing, so any critique is welcome, but my idea is somehow to implent the following: IController::whatEventsDoYouHandle() ICompositeView::addController(control:IController) { var desired:Array = control.whatEventsDoYouHandle(); for each(evt in desired) { addEventListener(evt.type, evt.func...) } } Apart from making sure I remove all listeners, is this a sensible way of utilising the same controllers models - for my same devices whilst just changing the button screens which interact with the devices??? When my system adds another device, I can add appropriate controllers and models then create my new screen(s) to utilise these as desired?? Any suggestions caveats, etc. Glen dr.ache wrote: Hi Glen. I would defenitively go with lose coupling and one controller by one device. You mentioned one requirement being the scaleability what new views are concerned - so there is no others choice. To proof the speed of that setup you need to implement a prototype of a likely application state. How should someone else know? But as a general tip: Always go with the better architecture - the speed comes with