Re: [flexcoders] Smooth Preloader
This should help: http://www.onflex.org/ted/2006/07/flex-2-preloaders-swf-png-gif-examples.php On 5/20/07, herklano [EMAIL PROTECTED] wrote: Hi, Any tips on how to make a smooth preloader on Flex for an SWF, without the big jumps. Or instead is there a away to check if a SWF is already in cache? i'm trying to use this, but the problem is that when the ProgressEvent stops the animation is not complete: percent -= (percent-((evt.bytesLoaded/evt.bytesTotal)*100))*.25; if (percent 99) { fpProgressBarMC.bar.width = Math.round (761 * percent / 100); } else { fpProgressBarMC.bar.width = 761; completeTimer.start(); //animOUT but wait on complete } -- Tim timwalling.com
Re: [flexcoders] Stopping embedded flash in Flex
Some recent posts regarding this subject: http://life.neophi.com/danielr/2007/05/stopping_flash_4_swf_with_soun.html#more http://www.jessewarden.com/archives/2007/05/controlling_fla.html Tim On 5/5/07, Abdul Qabiz [EMAIL PROTECTED] wrote: There is no interoperability between AS3 and AS2 apps that means you can't control or invoke anything in loaded SWF8 ( or less) from a SWF9 or more.. There are workarounds which use LocalConnection or ExternalInterface to achieve that. Infact, there are some projects around this problem. http://www.flashextensions.com/blog/2006/12/11/swfadapter-%E2%80%93-proxy-to-communicating-to-flash-8-swfs-from-flash-9/ -abdul On 5/3/07, Manish Jethani [EMAIL PROTECTED] wrote: On 5/2/07, John [EMAIL PROTECTED] wablam%40gmail.com wrote: I have a ViewStack that has a SWFLoader as one of the views. The problem is when I change views the flash on the first view(as well as the audio) is still running in the background. Anyway of stopping/pausing the flash when I switch Views? You can either unload it by setting the source to (or null). But I found that that doesn't stop the movie playing. So try calling stop() on the content. loader.content.stop(); I'm assuming the content will be a MovieClip, etc. Didn't work for me with an old Flash 7 SWF. -- Tim timwalling.com
Re: [flexcoders] Viewstack showEffect and hideEffect playing at the same time
That's right. I couldn't remember what the documentation said. I had to create my own viewstack component because I wanted to insert a resize effect in between the show and hide effects. Tim On 4/23/07, Manish Jethani [EMAIL PROTECTED] wrote: Wow, this page explicitly states that the ViewStack container waits for the completion of the effect specified by the hideEffect property for the container that is being hidden before it reveals the new child container. http://livedocs.adobe.com/flex/201/html/navigators_066_06.html Does that example (on that page) work for you? On 4/23/07, João [EMAIL PROTECTED] joao.saleiro%40webfuel.pt wrote: I have one viewStack with two views, both of them with the following effects: mx:Parallel id=showEffect duration=600 mx:Parallel target={p1} duration=600 mx:Move xTo=35/ mx:Fade alphaTo=1/ /mx:Parallel mx:Parallel target={p2} duration=600 mx:Move xTo=293/ mx:Fade alphaTo=1/ /mx:Parallel /mx:Parallel mx:Parallel id=hideEffect duration=600 mx:Parallel target={p1} duration=600 mx:Move xTo=-90/ mx:Fade alphaTo=0/ /mx:Parallel mx:Parallel target={p2} duration=600 mx:Move xTo=500/ mx:Fade alphaTo=0/ /mx:Parallel /mx:Parallel The problem here is that when changing between views, the showEffect of the view to show plays at the same time of the hideEffect of the view thats hiding. How can i make it to first hide the current view, and only the hiding finishes, the new view starts it's showEffect? Thanks, João Saleiro -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Tim timwalling.com
Re: [flexcoders] Viewstack showEffect and hideEffect playing at the same time
I don't think you can. I've had to write my own viewstack-like component in the past to achieve a series of animation effects. In my case it was a fade out, resize, fade in. You might have to write your own component as well if you can't live with the effects that you come up with using a regular ViewStack. Tim On 4/22/07, João [EMAIL PROTECTED] wrote: I have one viewStack with two views, both of them with the following effects: mx:Parallel id=showEffect duration=600 mx:Parallel target={p1} duration=600 mx:Move xTo=35/ mx:Fade alphaTo=1/ /mx:Parallel mx:Parallel target={p2} duration=600 mx:Move xTo=293/ mx:Fade alphaTo=1/ /mx:Parallel /mx:Parallel mx:Parallel id=hideEffect duration=600 mx:Parallel target={p1} duration=600 mx:Move xTo=-90/ mx:Fade alphaTo=0/ /mx:Parallel mx:Parallel target={p2} duration=600 mx:Move xTo=500/ mx:Fade alphaTo=0/ /mx:Parallel /mx:Parallel The problem here is that when changing between views, the showEffect of the view to show plays at the same time of the hideEffect of the view thats hiding. How can i make it to first hide the current view, and only the hiding finishes, the new view starts it's showEffect? Thanks, João Saleiro -- Tim timwalling.com
Re: [flexcoders] Compile CSS to SWF problem
The images you embed need to be accessible by the compiler. Is the images folder in the same directory as the CSS? Have you tried changing the path to the image? Tim On 06 Apr 2007 09:51:37 -0700, e_baggg [EMAIL PROTECTED] wrote: I have a .css file which compiles to a swf and I can load in via runtime without problem (using StyleManager.loadStyleDeclarations()). However, I receive compiler errors once I have Embed code in my css like below. I presume it is because the swf that the css gets compiled to does not have access to these images. Am I missing an easy work around so that my external style swf can have skinning? Thanks. .myButton{ upSkin:Embed(/images/buttonup.png, scaleGridTop='3', scaleGridBottom='20', scaleGridLeft='3', scaleGridRight='60'); overSkin: Embed(/images/buttonover.png, scaleGridTop='3', scaleGridBottom='20', scaleGridLeft='3', scaleGridRight='60'); downSkin: Embed(/images/buttondown.png, scaleGridTop='3', scaleGridBottom='20', scaleGridLeft='3', scaleGridRight='60'); -- Tim timwalling.com
Re: [flexcoders] dragProxy as image dosen't show image
Instead of loading the image for a second time you could just copy the raw bitmap data of the loaded image using something like this: http://www.flex2components.com/f2cblog/2006/05/18/flex2-dnd-bitmap-copy/ I follow this approach when creating drag proxies in order to get a copy of the item being dragged. Tim On 26 Mar 2007 03:59:26 -0700, Paolo Bernardini [EMAIL PROTECTED] wrote: Hi I was following the last example on http://www.adobe.com/devnet/flex/quickstart/adding_drag_and_drop/ I'm having a problem when I replace embedded images with dynamic URLs. this is the part of the code that I'm having problem with: // Create a copy of the coin image to use as a drag proxy. var dragProxy:Image = new Image(); dragProxy.source = event.currentTarget.source; if the source is embedded like in the example ([Embed(assets/5c.png)]) it works fine, but when replaced with a dynamic image, I can't see the proxy image been dragged. Has anyone else found this problem? any solution? by Paolo -- Tim timwalling.com
Re: [flexcoders] Re: What is the correct way to detect activation of a Canvas in a ViewStack?
If you need to run this code each time your view gains focus as you put it, then I think using the show event is fine because that should be triggered each time the viewstack sets a new child to be visible. If this code really only needs to run once, why don't you have your component just listen to its own creationComplete or initialize event? view:MyComponent initialize=handleInit() mx:Script private function handleInit():void { } /mx:Script /view:MyComponent On 3/26/07, wdsnapper [EMAIL PROTECTED] wrote: Thanks Tim. I initially tried using the show event on the component's canvas but it never got invoked. Then I realized that I had a canvas in the view stack that included my component: mx:ViewStack mx:Canvas id=myComponent1 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent2 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent3 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent4 view:MyComponent/ /mx:Canvas /mx:ViewStack view:MyComponent mx:Script ![CDATA[ private function myShowMethod1():void { } private function myShowMethod2():void { } ]] /mx:Script mx:ViewStack mx:Canvas id=myCanvas2 show=myShowMethod1() view:MyView1/ /mx:Canvas mx:Canvas id=myCanvas2 show=myShowMethod2() view:MyView2/ /mx:Canvas /mx:ViewStack /view:MyComponent I was expecting the myShowMethod1() and myShowMethod2() to be invoked when the view:MyComponent was brought into view and this was not the case. I ended up hooking the show event in myComponent1 and had this invoke a method in view:MyComponent and this worked. Is there a way to make sure the show gets invoked on my component? The problem is solved for now though just does not feel like the right way. Thanks. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tim Walling [EMAIL PROTECTED] wrote: You could try setting up a show event listener to trigger your initialization code. Something like this: mx:ViewStack mx:Canvas show=handleShowEvent()/ /mx:ViewStack Whenever the ViewStack makes the canvas the visible/active one, the show event would fire. or if your Canvas is an mxml component, it could handle the show event internally: mx:ViewStack view:MyCanvas/ /mx:ViewStack MyCanvas.mxml mx:Canvas show=handleShowEvent() mx:Script private function handleShowEvent(event:FlexEvent):void { // call initialize code } /mx:Script /mx:Canvas Then each of your components in the ViewStack would manage their respective show events. Tim On 23 Mar 2007 17:02:56 -0700, wdsnapper [EMAIL PROTECTED] wrote: I am using a ViewStack to contain a set of Canvas'. I switch between items in the stack by clicking on buttons. I want to be able to detect when a Canvas gains focus and run a method to initialize content on that Canvas. What is the correct event to monitor to achieve this behavior? Thanks in advance. -- Tim timwalling.com -- Tim timwalling.com
Re: [flexcoders] Re: What is the correct way to detect activation of a Canvas in a ViewStack?
Ok, I wouldn't feel wrong about this approach. We use a similar approach within an application at work where a custom viewstack is setting one of its children to visible, thereby causing the show event to fire. We rely on this to trigger some code that sets up the view properly based on changes that might have happened when the view was hidden. Tim On 3/26/07, wdsnapper [EMAIL PROTECTED] wrote: It does need to be run each time this Canvas gains focus. The short explanation is, one canvas has merchandise items available for sale. An item is marked as in cart when it is added do prevent a user from adding an item multiple times that is only allowed to be in the cart once. The cart lives on another Canvas in the stack. A user could choose to remove an item from the cart and then select that merchandise Canvas again and the button needs to be reactivated and have its label and style changed. Therefore the only way I knew to make this happen within the Flex model is to use a show event that triggered and caused the Canvas to update itself. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Tim Walling [EMAIL PROTECTED] wrote: If you need to run this code each time your view gains focus as you put it, then I think using the show event is fine because that should be triggered each time the viewstack sets a new child to be visible. If this code really only needs to run once, why don't you have your component just listen to its own creationComplete or initialize event? view:MyComponent initialize=handleInit() mx:Script private function handleInit():void { } /mx:Script /view:MyComponent On 3/26/07, wdsnapper [EMAIL PROTECTED] wrote: Thanks Tim. I initially tried using the show event on the component's canvas but it never got invoked. Then I realized that I had a canvas in the view stack that included my component: mx:ViewStack mx:Canvas id=myComponent1 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent2 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent3 view:MyComponent/ /mx:Canvas mx:Canvas id=myComponent4 view:MyComponent/ /mx:Canvas /mx:ViewStack view:MyComponent mx:Script ![CDATA[ private function myShowMethod1():void { } private function myShowMethod2():void { } ]] /mx:Script mx:ViewStack mx:Canvas id=myCanvas2 show=myShowMethod1() view:MyView1/ /mx:Canvas mx:Canvas id=myCanvas2 show=myShowMethod2() view:MyView2/ /mx:Canvas /mx:ViewStack /view:MyComponent I was expecting the myShowMethod1() and myShowMethod2() to be invoked when the view:MyComponent was brought into view and this was not the case. I ended up hooking the show event in myComponent1 and had this invoke a method in view:MyComponent and this worked. Is there a way to make sure the show gets invoked on my component? The problem is solved for now though just does not feel like the right way. Thanks. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders%40yahoogroups.com, Tim Walling tim.walling@ wrote: You could try setting up a show event listener to trigger your initialization code. Something like this: mx:ViewStack mx:Canvas show=handleShowEvent()/ /mx:ViewStack Whenever the ViewStack makes the canvas the visible/active one, the show event would fire. or if your Canvas is an mxml component, it could handle the show event internally: mx:ViewStack view:MyCanvas/ /mx:ViewStack MyCanvas.mxml mx:Canvas show=handleShowEvent() mx:Script private function handleShowEvent(event:FlexEvent):void { // call initialize code } /mx:Script /mx:Canvas Then each of your components in the ViewStack would manage their respective show events. Tim On 23 Mar 2007 17:02:56 -0700, wdsnapper bill@ wrote: I am using a ViewStack to contain a set of Canvas'. I switch between items in the stack by clicking on buttons. I want to be able to detect when a Canvas gains focus and run a method to initialize content on that Canvas. What is the correct event to monitor to achieve this behavior? Thanks in advance. -- Tim timwalling.com -- Tim timwalling.com -- Tim timwalling.com
Re: [flexcoders] What is the correct way to detect activation of a Canvas in a ViewStack?
You could try setting up a show event listener to trigger your initialization code. Something like this: mx:ViewStack mx:Canvas show=handleShowEvent()/ /mx:ViewStack Whenever the ViewStack makes the canvas the visible/active one, the show event would fire. or if your Canvas is an mxml component, it could handle the show event internally: mx:ViewStack view:MyCanvas/ /mx:ViewStack MyCanvas.mxml mx:Canvas show=handleShowEvent() mx:Script private function handleShowEvent(event:FlexEvent):void { // call initialize code } /mx:Script /mx:Canvas Then each of your components in the ViewStack would manage their respective show events. Tim On 23 Mar 2007 17:02:56 -0700, wdsnapper [EMAIL PROTECTED] wrote: I am using a ViewStack to contain a set of Canvas'. I switch between items in the stack by clicking on buttons. I want to be able to detect when a Canvas gains focus and run a method to initialize content on that Canvas. What is the correct event to monitor to achieve this behavior? Thanks in advance. -- Tim timwalling.com
Re: [flexcoders] Repeater Refresh
You need to use something like ArrayCollection which dispatches events. Your repeater should then pick up the changes and add the new item. Tim On 3/24/07, Jeffry Houser [EMAIL PROTECTED] wrote: I've done this with an ArrayCollections, but never with an Array. The code would be something like this: mx:Script ![CDATA[ public var myArray:Array = ['test1','test2','test3']; public var myArrayCollection = new ArrayCollection(myArray); public function addItem():void{ myArrayCollection.addItem('test4'); } ]] /mx:Script mx:VBox mx:Repeater id=rp dataProvider={myArrayCollection} mx:TextInput id=myRepeat / /mx:Repeater mx:Button label=click me click=addItem(); / /mx:VBox A few caveats... a) I didn't test this code b) In my situation, I wasn't adding from the same component that was displaying things, so the 'add' and 'display were never shown at the same time. There could have been other code that made the refresh work, but I don't remember anything explicit. c) When accessing a repeater element you use currentIndex when it is repeating, but repeaterIndex after the fact. I haven't found a simple way to switch between the two of them, but my solution was something like this: try{ return myArrayCollection.getItemAt(loop.currentIndex ); } catch (e:Error){ return myArrayCollection.getItemAt(loop.repeaterIndex ); } I imagine there must be a better way At 05:35 PM 3/24/2007, you wrote: here is a little test to illustrate what I am trying to do (except it doesn't work.) I was hoping that updating the dataProvider would add another item to the repeater... mx:Script ![CDATA[ public var myArray:Array = ['test1','test2' ,'test3']; public function addItem():void{ myArray.push('test4'); } ]] /mx:Script mx:VBox mx:Repeater id=rp dataProvider={ myArray} mx:TextInput id=myRepeat / /mx:Repeater mx:Button label=click me click=addItem(); / /mx:VBox On Mar 24, 2007, at 5:16 PM, Kevin wrote: I have a repeater (adding TextInput fields) that is bound to an ArrayCollection on my model. I was hoping that essentially I could add a row by just pushing a value into my ArrayCollection on the model. However, this isn't working. I assume I need to also refresh the repeater, but can't seem to figure out the best way to do that. Thanks, Kevin -- Jeffry Houser, Software Developer, Writer, Songwriter, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Company: http://www.dot-com-it.com My Podcast: http://www.theflexshow.com My Blog: http://www.jeffryhouser.com Connecticut Macromedia User Group: http://www.ctmug.com -- Tim timwalling.com