Re: [Flashcoders] XML loading and parsing problem
- Original Message - From: Omar Fouad [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 1:07 AM Subject: Re: [Flashcoders] XML loading and parsing problem YESS! thanks DUDE actually it worked without delegate, when i added ignore white...:D You only need to use a delegate when 'this' is different inside the onLoad function and where it's set up. If the xml is all setup on the main timeline, then 'this' is the same in both cases and the use of Delegate is not required, however if you set up the loading inside a class, you must use a delegate so that the class context will be accessible from within the onLoad function. Paul. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
- Original Message - From: Muzak [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 1:55 AM Subject: Re: [Flashcoders] XML loading and parsing problem 3 people posting similar (allmost identical) examples, all using Delegate should give you a clue ;-) Well, it may be a misleading clue since it's not strictly necessary if the code is on the main timeline.. It's completely wrong to insist that you have to use a delegate in all situations. Paul - Original Message - From: Omar Fouad [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 2:07 AM Subject: Re: [Flashcoders] XML loading and parsing problem YESS! thanks DUDE actually it worked without delegate, when i added ignore white...:D ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
erhmm.. Then show me how you use 'this' inside an xml onload handler to invoke a method outside the handler. Or better yet, prove me this: quote If the xml is all setup on the main timeline, then 'this' is the same in both cases /quote regards, Muzak - Original Message - From: Paul Andrews [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 5:10 PM Subject: Re: [Flashcoders] XML loading and parsing problem - Original Message - From: Muzak [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 1:55 AM Subject: Re: [Flashcoders] XML loading and parsing problem 3 people posting similar (allmost identical) examples, all using Delegate should give you a clue ;-) Well, it may be a misleading clue since it's not strictly necessary if the code is on the main timeline.. It's completely wrong to insist that you have to use a delegate in all situations. Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Re: Seeking Experienced Developer for Connecting Flash to Databases with Java
Why not just use openAMF and Hibernate to connect to your J2EE app database from Flash using Flash remoting. Hibernate will do all of the talking to Oracle (as long as you're not using BLOBs... that needs to be coded using JDBC alone at the moment). jord On Jul 7, 2007, at 2:22 AM, Phil Dupré wrote: So if I'm making the flash application in AS3, how difficult would it be to let it talk to the Oracle db? Do you think you'd be available for this integration? -- Jordan L. Chilcott, President Interactivity Unlimited Guelph, Ontario - Tel: (519) 837-1879 eFax: (253) 276-8631 mailto:[EMAIL PROTECTED] http://www.interactivityunlimited.com iChat/AIM: j1chilcott Author: Building Web Sites with Macromedia Studio MX Author: Building Dynamic Web Sites with Macromedia Studio MX Author: Flash Professional 8: Training From the Source Author: Foundation Flash 8 Video ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
On 7/8/07, Paul Andrews [EMAIL PROTECTED] wrote: It's completely wrong to insist that you have to use a delegate in all situations. True--another case where you don't need them is when using static functions. -- Mike Keesey ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Cross Domain Policy Files
This doesn't look like a crossdomain problem, specifically because you didn't see the sandbox security warning. Is this url testable? (e.g. should we click it and get something?) It may have something to-do with the https, how are you setting up the call to this - do you have the snipptet of code that's being used to read this value? Thanks - Fruber -Original Message- From: Paul Steven [mailto:[EMAIL PROTECTED] Sent: Saturday, July 07, 2007 8:53 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Cross Domain Policy Files I am trying to test calling a remote script from a flash CS3 movie and I am getting the following error Error opening URL 'https://dev01.maps-ict.com/services/upload/710665794/?key=keyvaluesession= sessionvalue' HTTPStatus: 0 IOError: Error #2032: Stream Error. URL: https://dev01.maps-ict.com/services/upload/710665794/?key=keyvaluesession=s essionvalue I am testing from the flash IDE and doing a search for this error lead to me to reading about the need for something called a cross domain policy file. Can anyone confirm that this is indeed required for me to call a script on a remote server from a test movie in the Flash IDE? I had hoped to get this app up and running over the weekend and I have no access to the remote server so I would really like to know if this is a show stopper or not? The script I am calling should return xml data. Thanks in advance Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
OK, my comment about 'this' isn't completely right, but I am certainly right about the use of Delegate for the XML loader. You comment about 'this' was completely wrong.. ;-) You're right if you say that *you don't have to* use Delegate to be able to access variables outside an onLoad hander, but the fact remains that the scope has changed, and that's the important part. When you do this: var foo = bar; test.onLoad = function(success) { trace(foo); } you're relying on Flash to look up the variable (which it will) and that's why it works. Things also get more complicated/missleading when you do something like this: var foo = bar; function loadHandler() { trace(foo); } test = new XML() // etc.. test.onLoad = loadHandler; Seeing it like that (nice and together) one could note that the loadHandler function runs in a different scope than the one it resides in (the timeline). But what if the loadHandler function and the onLoad assignment are separated by 100 lines of code? Then things aren't that obvious anymore and leads to missleading code. Using Delegate is just one of those best practices and should be used at all times, even if it kinda works without. regards, Muzak - Original Message - From: Paul Andrews [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 6:32 PM Subject: Re: [Flashcoders] XML loading and parsing problem OK, my comment about 'this' isn't completely right, but I am certainly right about the use of Delegate for the XML loader. If you don't use the Delegate class and try and access the attributes of a class within an onLoad function, you won't have access to the class atrributes, so you must use a delegate. If you don't use the Delegate class on the main timeline and try and access the variables declared on the timeline you will be able to access them, so you don't have to use a delegate. Stick the following code onto the timeline and see how you get on.. Paul stop(); var thisVariable:String=This is me; trace(this.thisVariable); var test:XML = new XML(); test.ignoreWhite = true; test.onLoad = function(success) { if (success) { trace(loaded); trace(thisVariable); trace(this.thisVariable); } }; test.load(test.xml); /* test.xml: test something / /test */ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
I never said you have to use a delegate in all situations. - Original Message - From: T. Michael Keesey [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 6:16 PM Subject: Re: [Flashcoders] XML loading and parsing problem On 7/8/07, Paul Andrews [EMAIL PROTECTED] wrote: It's completely wrong to insist that you have to use a delegate in all situations. True--another case where you don't need them is when using static functions. -- Mike Keesey ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
Using Delegate is just one of those best practices and should be used at all times, even if it kinda works without. +1 Also, Omar *might* want to refactor his code later. Using Delegate he likely won't run into any trouble. Cheers, Claus. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Cross Domain Policy Files
Thanks Fruber for the reply to my question The link should return some xml however it appears the server is down so it is unlikely to be up again until Monday. Anyway since posting, I have realised that for my application there is no need for a cross domain file as it will be a standalone executable packaged with Zinc. I have actually now decided to have a go at developing the app in Flex builder 2 which from what I have read seems like the perfect tool for the job. Cheers Paul From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fruber Malcome Sent: 08 July 2007 18:23 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] Cross Domain Policy Files This doesn't look like a crossdomain problem, specifically because you didn't see the sandbox security warning. Is this url testable? (e.g. should we click it and get something?) It may have something to-do with the https, how are you setting up the call to this - do you have the snipptet of code that's being used to read this value? Thanks - Fruber -Original Message- From: Paul Steven [mailto:[EMAIL PROTECTED] Sent: Saturday, July 07, 2007 8:53 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Cross Domain Policy Files I am trying to test calling a remote script from a flash CS3 movie and I am getting the following error Error opening URL 'https://dev01.maps-ict.com/services/upload/710665794/?key=keyvaluesession= sessionvalue' HTTPStatus: 0 IOError: Error #2032: Stream Error. URL: https://dev01.maps-ict.com/services/upload/710665794/?key=keyvaluesession=s essionvalue I am testing from the flash IDE and doing a search for this error lead to me to reading about the need for something called a cross domain policy file. Can anyone confirm that this is indeed required for me to call a script on a remote server from a test movie in the Flash IDE? I had hoped to get this app up and running over the weekend and I have no access to the remote server so I would really like to know if this is a show stopper or not? The script I am calling should return xml data. Thanks in advance Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
- Original Message - From: Muzak [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 6:22 PM Subject: Re: [Flashcoders] XML loading and parsing problem OK, my comment about 'this' isn't completely right, but I am certainly right about the use of Delegate for the XML loader. You comment about 'this' was completely wrong.. ;-) Well for lesser beings (from the flash help): this property this References an object or movie clip instance. When a script executes, this references the movie clip instance that contains the script. When a method is called, this contains a reference to the object that contains the called method. Inside an on() event handler attached to a button, this refers to the Timeline that contains the button. Inside an onClipEvent() event handler attached to a movie clip, this refers to the Timeline of the movie clip itself. Because this is evaluated in the context of the script that contains it, you can't use this in a script to refer to a variable defined in a class file. You're right if you say that *you don't have to* use Delegate to be able to access variables outside an onLoad hander, but the fact remains that the scope has changed, and that's the important part. Well, nobody ever mentioned that - Delegate was proposed as apparently the only way forward. When you do this: var foo = bar; test.onLoad = function(success) { trace(foo); } you're relying on Flash to look up the variable (which it will) and that's why it works. Well that's why *anything* works. Things also get more complicated/missleading when you do something like this: var foo = bar; function loadHandler() { trace(foo); } test = new XML() // etc.. test.onLoad = loadHandler; Seeing it like that (nice and together) one could note that the loadHandler function runs in a different scope than the one it resides in (the timeline). But what if the loadHandler function and the onLoad assignment are separated by 100 lines of code? Then things aren't that obvious anymore and leads to missleading code. I don't see what this has to do with delegate. I can use Delegate and still have 100 lines of code between it and the function. Using Delegate is just one of those best practices and should be used at all times, even if it kinda works without. Well, best practice wasn't mentioned until now. I think kinda works is actually does work. The OP was reporting a problem and many people seemed to suggest that Delegate was going to help solve the problem, something that was entirely erroneous. Best practice, fine. Only practice, no. regards, Muzak Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] writing as for components
hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
var letter:Array This should be var letters:Array Cheers, Claus. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
Did you notice the difference between identifier letter at variable definition and letters at later references? Attila =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= From:Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com flashcoders@chattyfig.figleaf.com Date:Sunday, July 8, 2007, 9:43:59 PM Subject: [Flashcoders] writing as for components --===-- hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
- Original Message - From: Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 8:43 PM Subject: [Flashcoders] writing as for components hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? var letter:Array The array is letter, not letters .. Paul The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
Thanks, but there is still the other error 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); Pedro 2007/7/8, Paul Andrews [EMAIL PROTECTED]: - Original Message - From: Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 8:43 PM Subject: [Flashcoders] writing as for components hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? var letter:Array The array is letter, not letters .. Paul The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
Sorry I did not see the other letters. I hate this kind of problems. Nothing works because of a letter(S) Thanks you very much It works now Pedro 2007/7/8, Pedro Kostelec [EMAIL PROTECTED]: Thanks, but there is still the other error 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); Pedro 2007/7/8, Paul Andrews [EMAIL PROTECTED]: - Original Message - From: Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 8:43 PM Subject: [Flashcoders] writing as for components hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? var letter:Array The array is letter, not letters .. Paul The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
- Original Message - From: Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 9:14 PM Subject: Re: [Flashcoders] writing as for components Thanks, but there is still the other error 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); Pedro The property should be letter, so letters is undefined (ie not declared). Paul 2007/7/8, Paul Andrews [EMAIL PROTECTED]: - Original Message - From: Pedro Kostelec [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Sunday, July 08, 2007 8:43 PM Subject: [Flashcoders] writing as for components hello: I've found a tutorial here:http://www.adobe.com/designcenter/video_workshop/ named writing ActionScript for Components. I have done all it wants me to do it but i got the following errors: 1120: Access of undefined property letters. var randomIndex:uint= Math.floor(Math.random()*letters.length); 1120: Access of undefined property letters return letters[randomIndex]; Can anyone tell me what is wrong? var letter:Array The array is letter, not letters .. Paul The code: var letter:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=o; var j:uint=0; var posX:uint=o; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] writing as for components
Pedro Kostelec wrote: Thanks, but there is still the other error 1120: Access of undefined property letters. var randomIndex:uint=Math.floor(Math.random()*letters.length); This code works for me: var letters:Array= [A,B,C,D,E,F, G,H,I,J,K,L, M,N,O,P,Q,R, S,T,U,V,W, X,Y,Z,]; function getRandomLetter():String { var randomIndex:uint=Math.floor(Math.random()*letters.length); return letters[randomIndex]; } import fl.controls.Button; var i:uint=0; var j:uint=0; var posX:uint=0; var posY:uint=0; var buttonSize:uint=25; while(posYstage.stageHeight){ posX=0; j=0; posY=i * buttonSize; while(posXstage.stageWidth){ posX= j * buttonSize; var b:Button= new Button b.setSize(buttonSize,buttonSize); b.move(posX, posY); b.label=getRandomLetter(); addChild(b); j++; } i++; } Cheers, Claus. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] XML loading and parsing problem
Look Ma! No Delegate /// var scope = this; var callback = xml_parse; xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = xml_loaded; xmlData.load ( gallery.xml ); function xml_loaded( success:Boolean ) { if ( success ) scope [ callback ] ( this ); } function xml_parse ( xml:XML ) { var total = xml.firstChild.firstChild.childNodes.length; trace ( this + xml_loaded :: total: + total ); } /// xmlData = new XML(); xmlData.scope = this; xmlData.ignoreWhite = true; xmlData.onLoad = function ( success:Boolean ) { if ( success ) this.scope.xml_parse ( this ); } xmlData.load ( gallery.xml ); function xml_parse ( xml:XML ) { var total = xmlData.firstChild.firstChild.childNodes.length; trace ( this + xml_loaded :: total: + total ); } /// Event Dispatcher /// xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = function ( success:Boolean ) { this.dispatchEvent ( { target:this, type:xml_onLoad, success:success } ) } mx.events.EventDispatcher.initialize ( xmlData ); xmlData.addEventListener ( xml_onLoad, this ); xmlData.load ( gallery.xml ); function xml_onLoad ( evt:Object ) { var xml = evt.target; var total = xmlData.firstChild.firstChild.childNodes.length; trace ( this + xml_loaded :: total: + total ); } /// Or, sorta Delegate style... /// function createAndLoadXML ( path:String, scope:Object, callback:Function ) { var func = function ( success:Boolean ) { this.onLoad = null; // clear some memory? var scope = arguments.callee.scope; var callback = arguments.callee.callback; callback.call ( scope, this, success ); } func.scope = scope; func.callback = callback; func.xml = new XML(); func.xml.ignoreWhite = true; func.xml.onLoad = func; func.xml.load ( path ); } function xml_parse ( xml:XML, success:Boolean ) { var total = xml.firstChild.firstChild.childNodes.length; trace ( this + xml_loaded :: total: + total ); } createAndLoadXML ( gallery.xml, this, xml_parse ); _ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Andrews Sent: Sunday, July 08, 2007 12:22 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] XML loading and parsing problem Best practice, fine. Only practice, no. regards, Muzak Paul ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] XML loading and parsing problem
Muzak, we all know you bought stock in Delegate back in the day - you're just protecting your assets. I'm still curious what the Delegate tattoo looks like... ;) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Sunday, July 08, 2007 3:57 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] XML loading and parsing problem The OP was reporting a problem and many people seemed to suggest that Delegate was going to help solve the problem, something that was entirely erroneous. I mentioned Delegate in response to this piece of code (posted by Fruber): gallery.onLoad = function( bSuccess ) { if ( bSuccess ) fun( this ); }; fun( xmlInfo:XML ):Void { // perform your XML stuff. } And then Omar asked: quoteMuzak... why Delegate??/quote regards, Muzak ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] XML loading and parsing problem
Damn, my secret's out :( - Original Message - From: Jesse Graupmann [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Monday, July 09, 2007 1:36 AM Subject: RE: [Flashcoders] XML loading and parsing problem Muzak, we all know you bought stock in Delegate back in the day - you're just protecting your assets. I'm still curious what the Delegate tattoo looks like... ;) ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onPress events from within a Class
Itai Asseo wrote: Hi - I am relatively new to Classes and OOP, and have come across a strange problem... I have a function in a class that creates dynamic buttons (xml driven). But when I try to actually use the buttons (ala 'onPress = function()') to fire up a different function within the class, it just won't work. it's like I'm outside the class now, and back to the main timeline. Before you suggest me to use the Delegate class, I've already done that. It works, but the problem is that I have an unspecified amount of buttons (could be 10, could be 400) -- and each needs to pass a parameter, or variable to keep score. The Delegate class wouldn't let me pass any other variables other than which object is passing the onPress function, and which function to refer it to... so I'm at a loss. if someone has a solution I would greatly appreciate it. One way is to create a MyButton clip in the library and attach a class to it. Something like: import mx.utils.Delegate; class MyButton extends MovieClip { public var answer:String; public function dispatchEvent() {}; public function addEventListener() {}; public function removeEventListener() {}; function MyButton() { super(); mx.events.EventDispatcher.initialize(this); onRelease = Delegate.create(this, release); } private function release():Void { dispatchEvent({target: this, type: release, answer: answer}); } } Then when you create the buttons: //this is what the onRelease calls function myButtonRelease(o:Object):Void { trace(o.answer); } //loop stuff var myButton = theTarget.attachMovie(MyButton, myButton + n, theTarget.getNextHighestDepth()+n); myButton.answer = foo; myButton.addEventListener(release, Delegate.create(this, myButtonRelease)); -Ricky ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] onPress events from within a Class
Instead of Delegate, use the Proxy class from Person13.com. It will make you happy. http://www.person13.com/articles/proxy/Proxy.htm On 7/8/07, Ricky Bacon [EMAIL PROTECTED] wrote: Itai Asseo wrote: Before you suggest me to use the Delegate class, I've already done that. It works, but the problem is that I have an unspecified amount of buttons (could be 10, could be 400) -- and each needs to pass a parameter, or variable to keep score. The Delegate class wouldn't let me pass any other variables other than which object is passing the onPress function, and which function to refer it to... ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] onPress events from within a Class
One way is to create a MyButton clip in the library and attach a class to it. - Ricky | Good Angel Instead of Delegate, use the Proxy class from Person13.com. It will make you happy. - Adam | Bad Angel ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com