Re: [Flashcoders] Path/Point interpolator
Thanks, I will study it. It does seem to be a bit more than I am hoping for :) 2010/10/27 Patrick Matte > I think this could help you > > > http://senocular.com/flash/actionscript/files/ActionScript_3.0/com/senocular > /drawing/Path.as > > > > From: Jiri > > Reply-To: Flash Coders List > > Date: Wed, 27 Oct 2010 12:08:48 +0200 > > To: Flash Coders List > > Subject: [Flashcoders] Path/Point interpolator > > > > hello, > > > > I have an array of points that define a path. I would like to > > interpolate the complete path, so that I can move an object along that > > path based on a position. > > So for instance when I tell the interpolator to move to postion .5 it > > would be in the middle of the path, based offcourse of the interpolator > > step/interval size. > > > > for instance: > > > > interpolator.interval = 3 pixels; > > interpolator.getPositionAt(.5) // would be the middle position. > > > > The solution I am after is that I dont want to precalculate all the > > positions up front, I would like to calulcate the position 'on the fly' > > so to say. > > > > Could someone give me a hint on how to tackle this. > > > > Much appreciated. > > > > Jiri > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > This e-mail is intended only for the named person or entity to which it is > addressed and contains valuable > business information that is proprietary, privileged, confidential and/or > otherwise protected from disclosure. > > If you received this e-mail in error, any review, use, dissemination, > distribution or copying of this e-mail > is strictly prohibited. Please notify us immediately of the error via > e-mail to disclai...@tbwachiat.com and > please delete the e-mail from your system, retaining no copies in any > media. We appreciate your cooperation. > > ___ > 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] Path/Point interpolator
hello, I have an array of points that define a path. I would like to interpolate the complete path, so that I can move an object along that path based on a position. So for instance when I tell the interpolator to move to postion .5 it would be in the middle of the path, based offcourse of the interpolator step/interval size. for instance: interpolator.interval = 3 pixels; interpolator.getPositionAt(.5) // would be the middle position. The solution I am after is that I dont want to precalculate all the positions up front, I would like to calulcate the position 'on the fly' so to say. Could someone give me a hint on how to tackle this. Much appreciated. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Embedding Fonts, it should be easy...., right!
He Keith, thanks for pointing that out to me. I tried and it still wont show any text. When I enumerate the fonts, and using the code provided by Keith I get this output embeddedFonts Array (@367abf39) [0] flash.text.Font (@369a56c1) fontName"MyriadProFont" fontStyle "regular" fontType"embedded" [1] flash.text.Font (@369a5701) fontName"MyriadProBoldFont" fontStyle "bold" fontType"embedded" [2] flash.text.Font (@369a5761) fontName"MyriadProFont" fontStyle "bold" fontType"embedded" [3] flash.text.Font (@369a57a1) fontName"MyriadProRegularFont" fontStyle "regular" fontType"embedded" length 4 So although regsitering two fonts to the Font class, it shows 4 Font instances in the embeddedFonts?? Anybody has another take? Jiri On 14-09-10 22:39, Keith Reinfeld wrote: The fontNames for each embedded font need to be distinct from one another. Use Font.registerFont(Class); to make the embedded fonts available to loaded swfs. Use the fontName when assigning format.font; [Embed( source='../../../../../fonts/myriad pro/MyriadPro-Bold.otf', fontName='MyriadProBoldFont', unicodeRange='U+0010-U+00FC', fontWeight = 'bold', fontFamily="Myriad Pro Bold", mimeType='application/x-font-truetype', embedAsCFF="false" )] public static var MyriadProBoldFont:Class; // Make the font available to loaded swfs Font.registerFont(MyriadProBoldFont); [Embed( source='../../../../../fonts/myriad pro/MyriadPro-Regular.otf', fontName='MyriadProRegularFont', unicodeRange='U+0010-U+00FC', fontWeight = 'normal', fontFamily="Myriad Pro Regular", mimeType='application/x-font-truetype', embedAsCFF="false" )] public static var MyriadProRegularFont:Class; // Make the font available to loaded swfs Font.registerFont(MyriadProRegularFont); Then: var tField:TextField = _sprite.getChildByName("field") as TextField; addFormatting( treatmentTimeInfo , STD_LABEL_FONT_SIZE , WHITE); function addFormatting(tField:TextField):void{ var format:TextFormat = new TextFormat() format.font = "MyriadProBoldFont"; format.bold = true; tField.defaultTextFormat = format; tField.embedFonts = true; tField.setTextFormat( format ); tField.text = "some_text" } HTH Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ 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] Embedding Fonts, it should be easy...., right!
Hello, i am really getting headache from Embedded font stuff in as3 and would like some help. I embedded the fonts by using the Embed tag: [Embed( source='../../../../../fonts/myriad pro/MyriadPro-Bold.otf', fontName='MyriadProFont', unicodeRange='U+0010-U+00FC', fontWeight = 'bold', fontFamily="Myriad Pro", mimeType='application/x-font-truetype', embedAsCFF="false" )] public static var MyriadProBoldFont:Class; [Embed( source='../../../../../fonts/myriad pro/MyriadPro-Regular.otf', fontName='MyriadProFont', unicodeRange='U+0010-U+00FC', fontWeight = 'normal', fontFamily="Myriad Pro", mimeType='application/x-font-truetype', embedAsCFF="false" )] public static var MyriadProRegularFont:Class; When I created a new TextField and setup the textformat to use the MyriadProFont and add it to the list all works fine. Using this snippet I checked to see if the font is really registered and it is. var embeddedFonts:Array = Font.enumerateFonts(false); embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE); Now we also have swf's that gets loaded in. The designer has put textfields in place. I need add the textformat to it. But the damn embedding doesn work. It doesnt render any text. I searched but could not find any solution. I hope someone here has a solution. Below the code i use. var tField:TextField = _sprite.getChildByName("field") as TextField; addFormatting( treatmentTimeInfo , STD_LABEL_FONT_SIZE , WHITE); function addFormatting(tField:TextField):void{ var format:TextFormat = new TextFormat() format.font = "Myriad Pro"; format.bold = true; tField.defaultTextFormat = format; tField.embedFonts = true; tField.setTextFormat( format ); tField.text = "some_text" } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Question FP10 inactive event dispatched when not visible.
I was reading some where that FP 10 now drops the framerate and pause any loading activities when it looses browser focus in the case of browser tab changing. I can't seem to find the article anymore, but I am wondering if there is also an event being dispatched when FP goes into 'hybernation'. Does somebody know if that is done, or could point me to an article describing this behaviour Regards, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Could this be done more elegant.
No it won't because of this line that calls a toggle function based on the current fps. if(buffer == 0) adjustQuality() function adjustQuality():void{ fps = (fps == 45) ? 20 : 45 trace("qulaity is now adjusted to : " , fps ) } On 13-08-10 16:58, Cor wrote: In case the framerate get>= 45, wouldn't this put the framerate up to a endless high number? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu Sent: vrijdag 13 augustus 2010 16:36 To: Flash Coders List Subject: Re: [Flashcoders] Could this be done more elegant. This doesn't change the way it works, but you could rewrite the addValue stuff to this: buffer += (fps>= 45) ? 1 : -1; On Fri, Aug 13, 2010 at 4:45 AM, Jiri wrote: Thanx for the answer, I am on a project where the whole thing is allready set up. The quality is now set to BEST as soon as the FPS goes under 30 (i used 45 in my example), but on fast machine this results in very short graphical glitches, because it is usually only 1 or 2 frames where the FPS is below 30. I wanted to prevent this and make the profiling a bit better. Not toggle all the time, but just wait a bit before doing the call. So it is not so much about the execution based on EnterFrame but more on how to write the function a bit cleaner. Jiri On 13-08-10 10:29, Henrik Andersson wrote: I use a different event than what you are most likely using. I use the Render event. It is a bit more effort since you have to request it again and again, but it is more accurate for the rendered fps. It differs from the enter frame event in that it is not dispatched when the player is skipping frames. ___ 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] Could this be done more elegant.
Thanx for the answer, I am on a project where the whole thing is allready set up. The quality is now set to BEST as soon as the FPS goes under 30 (i used 45 in my example), but on fast machine this results in very short graphical glitches, because it is usually only 1 or 2 frames where the FPS is below 30. I wanted to prevent this and make the profiling a bit better. Not toggle all the time, but just wait a bit before doing the call. So it is not so much about the execution based on EnterFrame but more on how to write the function a bit cleaner. Jiri On 13-08-10 10:29, Henrik Andersson wrote: I use a different event than what you are most likely using. I use the Render event. It is a bit more effort since you have to request it again and again, but it is more accurate for the rendered fps. It differs from the enter frame event in that it is not dispatched when the player is skipping frames. ___ 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] Could this be done more elegant.
Hello, I wrote a routine that checks if the fps is below 45 fps for longer then 20 ticks, I toggle the quality of the SWF. If it then after is greater then 45 fps for 20 ticks I toggle quality back up. It works, but out of interested, I was wondering if this could be done in a other more cleaver way then I did. Looking at the routine it feels very 'big', because I use 3 external vars and quite some code. var treshold:Number = 20; var buffer:Number = treshold; var addValue:int; function doProfiling(e:Event):void{ if(fps>=45){ addValue = 1 }else{ addValue = -1 } buffer+=addValue if(buffer > treshold) { buffer = treshold; }else if(buffer < -treshold) { buffer = -treshold; }else if(buffer == 0) adjustQuality() } Cheers, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] const inside function
Ok, thanks. Yes that makes sense. I was thinking that it might be a slight enhancement to speed up execution time of a function. Jiri On 05-08-10 19:20, Juan Pablo Califano wrote: The difference is that the reference is constant, meaning you cannot change it. You can't do this: const my_var:String = "my_var"; my_var = "other text"; You could do this if it were declared as a var. Cheers Juan Pablo Califano 2010/8/5 Jiri I have a simple question. I came across some code in a project that defines a const in a function. function doSomething():void{ const my_var:String = "my_var" var buffer:String = ''; for(var i:int = 0 ; ihttp://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] const inside function
I have a simple question. I came across some code in a project that defines a const in a function. function doSomething():void{ const my_var:String = "my_var" var buffer:String = ''; for(var i:int = 0 ; ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Question on variable init in a for loop
I have the following case: var l:Array = [{},{}] function test():void{ for each(var i:Object in l){ var id:String;// = null; trace("1" ,id); id = "test" + Math.random().toString(); trace("2" ,id); } } I seems that 'id' is not resetted to null on every iteration as I would expect. I have to explicitly set the id to null myself! Does some know why this is, or are my expectations just wrong. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] colorpallete pngencoder
Hello, i am using the PNGEncoder to create png's.Does someone know how and if it is possible to set the colorpalette of the bitmap data, before encoding it into a png? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] JSFL question on shapes and strokes.
Hello, I am trying to convert some drawings on stage into a movieclip via jsfl. It works when all the elements on stage are separatly grouped. JSFL doesnt seem to 'see' non grouped drawings as seperate entities. To clearify, I have on frame on the main timeline. In this frame I have three shapes that are grouped and two shapes that are just plain circles made of a stroke. So in total I have 5 entities on stage. The JSFL script below outputs just three times. Does anybody know how I can get all five shapes on stage via jsfl, no matter if the are grouped or just drawings? I want each item to be converted into a MovieClip. var doc = fl.getDocumentDOM() var tl = doc.getTimeline() var layers = tl.layers; tl.setSelectedLayers(0); fl.outputPanel.clear(); for (var l=0; lhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Distribute evenly over half a circle
tnx Erik. Jiri On 23/03/2010 16:33, Mattheis, Erik (MIN - WSW) wrote: Half a circle is PI radians, so you'd increment by Math.PI / (totalNumbers - 1) Try - function plot():void { var totalNumbers:int = 5; var radius:Number = 30; var startAt:Number = Math.PI/2; var arc:Number = Math.PI / (totalNumbers - 1); for (var angle:Number = startAt; angle< startAt + (arc * totalNumbers); angle += arc) { var c:clip = new clip() addChild( c ) c.x = Math.sin( angle ) * radius; c.y = Math.cos( angle ) * radius; } } _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 – Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: Tuesday, March 23, 2010 9:30 AM To: Flash Coders List Subject: [Flashcoders] Distribute evenly over half a circle Does someone know how to distribute a n number of sprite of a top half circumference of a cicrle. I have this, but cant figure out the offset. function plot():void { var totalNumbers:int = 5; var slice:Number = ( 180 / totalNumbers ); var p:Point; for (var n:Number=0; n< totalNumbers; n++) { var angle:Number = slice* n var rad:Number = (Math.PI / 180 * angle); var vx:Number = Math.sin( rad ); var vy:Number = Math.cos( rad ); var c:clip = new clip() c.x = 300 + vx * 100 c.y = 300 + vy * 100 addChild( c ) } } Thnx, Jri ___ 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] Distribute evenly over half a circle
Does someone know how to distribute a n number of sprite of a top half circumference of a cicrle. I have this, but cant figure out the offset. function plot():void { var totalNumbers:int = 5; var slice:Number = ( 180 / totalNumbers ); var p:Point; for (var n:Number=0; n < totalNumbers; n++) { var angle:Number = slice* n var rad:Number = (Math.PI / 180 * angle); var vx:Number = Math.sin( rad ); var vy:Number = Math.cos( rad ); var c:clip = new clip() c.x = 300 + vx * 100 c.y = 300 + vy * 100 addChild( c ) } } Thnx, Jri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Strange RegExp behaviour
Hello, i would like some help, because I am confused. If have a Movieclip that holds several sprites some of them have instance names like so frame_ where n is a number. I then loop through every child of the MovieClip and test the instance name using regExp. var childs:int = clip.numChildren-1; var pat:RegExp = /_[0-9]+$/ig; while(childs >= 0){ var instance:DisplayObject = clip.getChildAt( childs ); if( pat.test(instance.name) ){ Logger.debug( "info box frame" , instance.name ); } childs-- } I have three movieclips called 'frame_0' , 'frame_1' and 'frame_2' for sure, but it when I run the above code, it only show 1 and 0?? Anybody has an idea? Jiri On 11/03/2010 22:16, Guest Services, City Concierge wrote: We're looking for a coder to some small contract work We're in Los Angeles Should know action script very well, and be able to get the flash scripts to work in .asp and .php and use XML Ask for Jefferson 323-874-6610 ___ 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] bitwise question
Cheers. Jiri Paul Andrews wrote: Juan Pablo Califano wrote: Another option: function test(value:int):int { // just to be safe... value = value & 0xff; switch(value) { case 0x01: return 0; case 0x02: return 1; case 0x04: return 2; case 0x08: return 3; case 0x10: return 4; case 0x20: return 5; case 0x40: return 6; case 0x80: return 7; default: return -1; } } Cheers Juan Pablo Califano Yes, this is the best way to do it. Paul ___ 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] bitwise question
Can't confirm your findings right now, and also wonder which loop you are talking about. My initially posted one? >>>> function getBit():int{ >>>> var tCount:int = 0; >>>> for (var i:int=0; i < 8; i++) { >>>> if (8 & (1 << i))return i; >>>> } >>>> return 0; >>>> } or the one suggested by John McCormack. I cant remember have faulty result with my loop because like Glen Pike mentioned the i is used for the shifting. Also the 8bit to test will always only have one bit set to 1. Which could be a potential dangerous assumption i guess. 0001 0010 0100 etc.. Will do testing tomorrow. jiri John McCormack wrote: It's a little curious loop! i=0 i shifted = 0 i++ gives = 1 binary 0001 i shifted = 2 binary 0010 i++ gives i=3 binary 0011 i shifted=6 binary 0110 i++ gives i= 7 binary 0111 i shifted=14 binary 1110 End of loop because i>=8 i++ gives i= 15 binary i shifted= 30 binary 0001 1110 John Glen Pike wrote: I think his i < 8 was valid as the i is used for the shift, not the value... The only thing that might be faster is using i-- rather than i++ - for some reason decrementing through a loop is suppsoed to be faster. Glen :) John McCormack wrote: Jiri, I haven't done much bit twiddling yet in AS3 but I think you were fast already, but your i was being incremented and shifted. Also i<8 would only get you bits 2,1,0 In binary that would be i<1000 How about: function getBit(var numb:int):int { var bit:int=1; var count:int=0; if (numb==0 || numb>0x80) return -1; // error while (bit & numb == 0) { 1 << bit; count++; } return count; } John Jiri wrote: When i have a 8 bit int where only one of the bit can be 1, what is then the quickest way to get that bit position with value 1? Now I use this. function getBit():int{ var tCount:int = 0; for (var i:int=0; i < 8; i++) { if (8 & (1 << i))return i; } return 0; } Can this be done faster? ___ 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] bitwise question
Thnx, i tought that there would be some kind of smart bitwise operation to do that. This will do fine. Cheers. Jiri Paul Andrews wrote: Paul Andrews wrote: Jiri wrote: When i have a 8 bit int where only one of the bit can be 1, what is then the quickest way to get that bit position with value 1? Now I use this. function getBit():int{ var tCount:int = 0; for (var i:int=0; i < 8; i++) { if (8 & (1 << i))return i; } return 0; } Can this be done faster? Yes. Use a lookup table; var lookup:Array=[]; for (var n:int=0; n<128;n++) { lookup.push(0); } lookup[2]=1; lookup[4]=2; lookup[8]=4; //etc.. function getBit(n:int):int{ return lookup[n]; } LOL, better still, just ditch the function altogether and use lookup[somevariable] directly. I might as well comment that this is lean and mean without any safety net to make sure the int is in range and indeed has only one bit set. Paul Jiri ___ 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] bitwise question
When i have a 8 bit int where only one of the bit can be 1, what is then the quickest way to get that bit position with value 1? Now I use this. function getBit():int{ var tCount:int = 0; for (var i:int=0; i < 8; i++) { if (8 & (1 << i)) return i; } return 0; } Can this be done faster? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Syntax coloring Eclipse
I am forced to use eclipse, but i am used to work with a black background. I changed the syntax coloring in the eclipse preferences to match my preferences, but the symbols " . , " ect.. are all black and there is not an option provided to changes there color. If you look at the Java syntax coloring options they are much more refined. I am looking into the FlexBuilder app root directory now to see if i can find the xml file that is defining the colors, which i cannot find. Does anyone know how i can find it, what to look for or how to deal with the super annoying thing that should be provided in any decent editorthank you Adobe !! Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question on preventing this array[n] = 'whatever' on Array var
Thanx. Well i could extend Array and then override all the methods and have them dispatch events, like ON_CHANGE. Overwriting all the public mehtods is a pain, so I suspect i can use the flash.utils.Proxy for this. I just need to understand this utils.Proxy and flash_proxy thing. Could somebody hint me if this would be worth looking into for this particular case? Jiri Glen Pike wrote: Sounds like you want to use a kind of "Observer" pattern: Can you "wrap" up your array class in something that implements the methods you want, ignores / passes on the stuff you care about and then notifiies listeners of any changes that you care about? Flex makes this quite easy with {watching} objects virtually automatically - not sure if there is something in PureAS3 that would help without requiring some huge framework. The safest way of doing this though might be to prevent any external class accessing your array. Make your class implement some kind of "ArrayInterface" and allow the calling classes to use your class rather than your array to add and remove things? Glen Jiri wrote: Hello list, Lets say I have a class with a public getter to a private var which holds an Array. Some other class can do this then: var tArr:Array = class.myArray; I can then do this: tArr.push(int) and the content of the array has changed without the class knowing. This is in most cases I use it ok, but now I am wondering how to deal with it when I really want to create a read only array. I am aware that I can copy it, but then this can be very expensive when it is requested a lot of times and it is a relative big array. So i was thinking the following. class A{ private var pArray:Array = [1,2,3] public function get list():listArray{ return new listArray(pArray); } } class listArray{ private var pList:Array public function listArray(tArr:Array):void{ pList = listArray } override function push():void{ throw new IllegalOperationError() } } I would have to override all the public methods of Array which can be a pain. My question is. How would I prevent users from doing this: listArray[n] = 'whatever' Much appreciated Jiri ___ 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] Question on preventing this array[n] = 'whatever' on Array var
Hello list, Lets say I have a class with a public getter to a private var which holds an Array. Some other class can do this then: var tArr:Array = class.myArray; I can then do this: tArr.push(int) and the content of the array has changed without the class knowing. This is in most cases I use it ok, but now I am wondering how to deal with it when I really want to create a read only array. I am aware that I can copy it, but then this can be very expensive when it is requested a lot of times and it is a relative big array. So i was thinking the following. class A{ private var pArray:Array = [1,2,3] public function get list():listArray{ return new listArray(pArray); } } class listArray{ private var pList:Array public function listArray(tArr:Array):void{ pList = listArray } override function push():void{ throw new IllegalOperationError() } } I would have to override all the public methods of Array which can be a pain. My question is. How would I prevent users from doing this: listArray[n] = 'whatever' Much appreciated Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] separating MouseEvent.MOUSE_UP from MouseEvent.CLICK
nice! Good luck. Jiri Karl DeSaulniers wrote: Thanks Jiri, That worked perfectly. I knew I had been looking at this code too long and that it was something as simple as deleting a couple of parenthesis. Thanks again.. Karl On Jul 12, 2009, at 2:47 PM, Jiri wrote: I think that it makes sense that the functions like formHidden() gets called, because that is what you put down. It think you will need to put only the function name/ref like so: this.quoteRequest_mc.ySlideTo(quoteHideY,4,"easeoutbounce",.5, formHidden ,20,4.5); Give it a try. Jiri Karl DeSaulniers wrote: Hello List, I'm having an issue getting my MC_Tween2 scripts to behave appropriately. AS2. I am trying to set a function that triggers after the tween is done. I am sure this is easier than I am figuring, but I'm stuck. I can get the tweens to work, but they trigger the function while tweeneing. [code eg] var beginAlpha = 0; var endAlpha = 100; var quoteShowY:Number = 219.9; var quoteHideY:Number = -219.9; this.quoteRequest_mc._y = quoteHideY; function formVisible() { if (!this.quoteRequest_mc.isTweening()) {//this way doesn't work at all ??? this.quoteRequest_mc.gotoAndPlay(2); } } function formHidden() { //this way plays while hideForm() is Tweening this.quoteRequest_mc.gotoAndStop(1); } function showForm() { this.quoteRequest_mc.alphaTo(endAlpha,3.5,"easeoutquint",.5); this.quoteRequest_mc.ySlideTo(quoteShowY,4,"easeoutbounce",.5,formVisible(),20,4.5); } function hideForm() { this.quoteRequest_mc.alphaTo(beginAlpha,3.5,"easeoutquint",.5); this.quoteRequest_mc.ySlideTo(quoteHideY,4,"easeoutbounce",.5,formHidden(),20,4.5); } showForm(); What on earth am I doing wrong?? It all looks like it should work! Also, on the tweens themselves, they dont play very smooth. Am I doing somthing wrong with the timing or the ease period or amount of ease? What? I want them to play somewhat quickly, but smooth. Thank you for any help. Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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 Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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] separating MouseEvent.MOUSE_UP from MouseEvent.CLICK
I think that it makes sense that the functions like formHidden() gets called, because that is what you put down. It think you will need to put only the function name/ref like so: this.quoteRequest_mc.ySlideTo(quoteHideY,4,"easeoutbounce",.5, formHidden ,20,4.5); Give it a try. Jiri Karl DeSaulniers wrote: Hello List, I'm having an issue getting my MC_Tween2 scripts to behave appropriately. AS2. I am trying to set a function that triggers after the tween is done. I am sure this is easier than I am figuring, but I'm stuck. I can get the tweens to work, but they trigger the function while tweeneing. [code eg] var beginAlpha = 0; var endAlpha = 100; var quoteShowY:Number = 219.9; var quoteHideY:Number = -219.9; this.quoteRequest_mc._y = quoteHideY; function formVisible() { if (!this.quoteRequest_mc.isTweening()) {//this way doesn't work at all ??? this.quoteRequest_mc.gotoAndPlay(2); } } function formHidden() { //this way plays while hideForm() is Tweening this.quoteRequest_mc.gotoAndStop(1); } function showForm() { this.quoteRequest_mc.alphaTo(endAlpha,3.5,"easeoutquint",.5); this.quoteRequest_mc.ySlideTo(quoteShowY,4,"easeoutbounce",.5,formVisible(),20,4.5); } function hideForm() { this.quoteRequest_mc.alphaTo(beginAlpha,3.5,"easeoutquint",.5); this.quoteRequest_mc.ySlideTo(quoteHideY,4,"easeoutbounce",.5,formHidden(),20,4.5); } showForm(); What on earth am I doing wrong?? It all looks like it should work! Also, on the tweens themselves, they dont play very smooth. Am I doing somthing wrong with the timing or the ease period or amount of ease? What? I want them to play somewhat quickly, but smooth. Thank you for any help. Karl DeSaulniers Design Drumm http://designdrumm.com ___ 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] problem with swfaddress
Try naming the : var attributes={id:"MainMafle"} to var attributes={id:"main1"} Not sure if it will help, but I can remember some wierd issues with swfaddress and the id. Jiri Gustavo Duenas wrote: Hi I have a problem in swf address, I've been following the example on gotoandlearn.com and this is my second time, first time went good, but this time is odd. here is my code on the flash side: stop(); import com.asual.swfaddress.SWFAddress; import com.asual.swfaddress.SWFAddressEvent; import flash.display.*; import flash.filters.*; import flash.display.BlendMode; import flash.net.URLLoader; import flash.net.URLRequest; import flash.display.Loader; import flash.text.StyleSheet; import fl.controls.UIScrollBar; //swfaddress// SWFAddress.addEventListener(SWFAddressEvent.CHANGE, onChange); function onChange(e:SWFAddressEvent):void{ trace(e.value); if(e.value != "/") SWFAddress.setTitle("Mafle Photography Jacksonville Fl-" + e.value.substring(1)); else SWFAddress.setTitle("Mafle Photography - Home"); } function aboutUs():void{ SWFAddress.setValue("AboutUs"); trace("about"); } function commercialPics():void{ SWFAddress.setValue("Commercial"); trace("commercial"); } function contactUs():void{ SWFAddress.setValue("Contact"); trace("contact"); } function modelPictures():void{ SWFAddress.setValue("Models"); trace("models"); } function portraitPics():void{ trace("portraits"); SWFAddress.setValue("Portraits"); } function weddingPictures():void{ SWFAddress.setValue("Weddings"); trace("weddings"); } function engagementPictures():void{ SWFAddress.setValue("Engagements"); trace("engagements"); } function homeMafle():void{ SWFAddress.setValue("Home"); trace("home"); } function blogMafle():void{ SWFAddress.setValue("Blog"); trace("blog"); } function stockPictures():void{ SWFAddress.setValue("Stock"); trace("stock"); } function clickDefault():void{ SWFAddress.setValue("Default"); trace("default"); } function onClick(e:MouseEvent):void{ if (e.currentTarget.name == "about"){ aboutUs(); }else if(e.currentTarget.name=="commercial"){ commercialPics(); }else if(e.currentTarget.name=="weddings"){ weddingPictures(); }else if(e.currentTarget.name=="portraits"){ portraitPics(); }else if(e.currentTarget.name=="engagements"){ engagementPictures(); }else if(e.currentTarget.name=="contact"){ contactUs(); }else if(e.currentTarget.name=="models"){ modelPictures(); }else if(e.currentTarget.name=="stock"){ stockPictures(); }else if(e.currentTarget.name=="blog"){ blogMafle(); }else if(e.currentTarget.name=="home"){ homeMafle(); }else { clickDefault();} } ok, I've been doing everything as the video said, but I don't see a problem in the flash. here is my html code. Untitled Document var attributes={id:"MainMafle"} </pre><tt>swfobject.embedSWF("main1.swf", "content", "1024", "768", </tt><tt>"10.0.0",null,null,null, attributes); </tt><pre style="margin: 0em;"> OK. everything is looking good, but in someway it is not working, someone please help me out. Gustavo ___ 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] Strange characters added to file when saving from AIR using fileStream
I had similair behaviour. Save the xml as UTF-8 and it should be allright. J Kenneth Kawamoto wrote: I may be wrong but that could be BOM? If you use writeUTF() and open the resulting file in a Unicode editor do you still see it? Kenneth Kawamoto http://www.materiaprima.co.uk/ Cheetham, Marcus wrote: I'm using fileStream to save a text file. This works OK, but introduces some strange characters at the beginning of the saved text. I'm saving XML data. I've kept this as an XML object and also converted it to string -- same thing always happens. Any idea how I can get rid of these characters? Thanks, This is what I end up with (note the 'g at the beginning) : 'g burger 3.95 fries 1.45 This is the Flex 3 code: http://www.adobe.com/2006/mxml"; layout="absolute" activate="createXML()"> ___ 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] AS3 MOUSE_OVER/OUT bubbling
Did u try ROLL_OVER / ROLL_OUT to? Jiri Andrew Sinning wrote: I've read though the documentation regarding event bubbling several times, but the concept remains blurry. Perhaps this example will help me get my head around it. I want to display a custom cursor, a version of the Photoshop "flat hand" cursor, whenever the mouse is over a cropped image to indicate that it can be moved around within the frame. So, I have for the sprite of the image, MOUSE_OVER turns on and MOUSE_OUT turns off the custom cursor. The custom cursor object simply hides or displays the Mouse and has a sprite on the top level of the stage with startDrag() and stopDrag(). The problem is that as soon as the custom cursor's sprite becomes visible, it causes a MOUSE_OUT event to get called on the image (because the image is intercepting the mouse-over?) and then the custom cursor gets turned off again. The result is a flashing cursor. Nice effect, but not what I have in mind. Thanks in advance for any guidance! ___ 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] When to use flash.util.proxy
Hello list, i am reading up on the flash.util.Proxy class and I came across this post: http://www.onflex.org/ted/2006/04/magic-with-flashutilproxy.php The author mentions this: "..Using Proxy is best reserved for situations when you want very fine grained control of behavior. The are very useful for dynamic method calls, like WebServices, Remoting, or in general creating a Facade for any type of object..." I dont really understand the remark and was wondering if someone could explain it to me. I am trying to figure out when the usage of this proxy would be handy. What is the difference with using normal getters and setters? Could somebody tell me of a case where he/she used this flash.util.proxy? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] gzipped xml receiving with flash
Hello list, Would it be possible to have a apache server return a gzipped version of xml (using the mod_deflate) and then uncompress the gzipped file in as3. I guess that the BrowserMatch inside the httpd.conf would need to be set to a HTTP request comming from the flash player. Would it possible for the flash player to mimick a call made directly from a browser? So that the apache returns an actuall gzipped version. If it could be possible, how would this then be handled inside flash. I reckon the loader would need to load the file as a BINARY and then a gzip parser would deal with it? I know AMF would work for what i want, or have the server preprocess the files into a .zip. But i was just wondering and curious. As my questions probably reveal, i am not an expert in this area, so excuse me if my questions are really naive. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Determining probablity of a random pick.
I see, that makes sense. Cheers. Jiri Paul Andrews wrote: Jiri wrote: Thank you i understand it. Could u please elloborate on the last part "..You can optimise this by using an array of pointers.." Do you mean that this; First calculated the range for each node. A = 0 - 5 B = 6 - 7 C = 8 - 10 Then store in an array like so? Array[0-5] = A Array[6-7] = B Array[8-10] = C Last step get a random number between 0 - 10 => for instance 5 //result is then return Array[5] as XML If this is what you mean, would this approach not take a 'relatively' big amount of memory? You don't have to store the node itself, just a reference to it, so no it wouldn't be a memory hog. It could even just be the numerical index of the node. Paul JIri Paul Andrews wrote: Jiri wrote: Hello list, I have an XMLList that can vary in length. I pick a random node each time using the simple method below: var tRandom:int = int(Math.random()*tXMLSource.nodes.length() ); return tXMLSource.nodes[tRandom] Now i would like to change it, so that I can specify a weight to each node. This weight would have to determine the probability the nodes get selected out when a random pick is being performed. Does anybody know how to build such an algorithm? Sum all of the node weights, then generate a random number within that range. Now you have to find the node corresponding to that number. This can be done by traversing the nodes in sequence. As you traverse the nodes sum the weight until the value generated is within the range - then you have the right node. You can optimise this by using an array of pointers, or keeping the weights in an external array, but that may be more or less interesting depending on the number of nodes involved and what optimisation you need. Paul Much appreciated, Jiri ___ 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] Determining probablity of a random pick.
Thank you i understand it. Could u please elloborate on the last part "..You can optimise this by using an array of pointers.." Do you mean that this; First calculated the range for each node. A = 0 - 5 B = 6 - 7 C = 8 - 10 Then store in an array like so? Array[0-5] = A Array[6-7] = B Array[8-10] = C Last step get a random number between 0 - 10 => for instance 5 //result is then return Array[5] as XML If this is what you mean, would this approach not take a 'relatively' big amount of memory? JIri Paul Andrews wrote: Jiri wrote: Hello list, I have an XMLList that can vary in length. I pick a random node each time using the simple method below: var tRandom:int = int(Math.random()*tXMLSource.nodes.length() ); return tXMLSource.nodes[tRandom] Now i would like to change it, so that I can specify a weight to each node. This weight would have to determine the probability the nodes get selected out when a random pick is being performed. Does anybody know how to build such an algorithm? Sum all of the node weights, then generate a random number within that range. Now you have to find the node corresponding to that number. This can be done by traversing the nodes in sequence. As you traverse the nodes sum the weight until the value generated is within the range - then you have the right node. You can optimise this by using an array of pointers, or keeping the weights in an external array, but that may be more or less interesting depending on the number of nodes involved and what optimisation you need. Paul Much appreciated, Jiri ___ 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] Determining probablity of a random pick.
Hello list, I have an XMLList that can vary in length. I pick a random node each time using the simple method below: var tRandom:int = int(Math.random()*tXMLSource.nodes.length() ); return tXMLSource.nodes[tRandom] Now i would like to change it, so that I can specify a weight to each node. This weight would have to determine the probability the nodes get selected out when a random pick is being performed. Does anybody know how to build such an algorithm? Much appreciated, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Delete node using e5x inline.
Thnx, but delete is not a method of XMLList so you suggestion wont work. I guess I will have to build an loop, but it feels like overhead, becuase e4x should support it, or am i wrong. Jiri Glen Pike wrote: Is it because you are using: delete pXML.randomImage.(attribute("delete") == "true")[0] rather than delete pXML.randomImage.(attribute("delete") == "true") Glen Jiri wrote: List, Does anyone know how to delete nodes from an xml using ex4 and a condition specific in the node. I really need to delete these nodes. For example: var tXML:XML = new XML( ) var pXML:XMLList = tXML.image_conf; When i then use this: delete pXML.randomImage.(attribute("delete") == "true")[0] Not all the nodes with @delete = 'true' are removed. trace(pXML.toXMLString()) // this is what is the output looks like Much appreciated. Jiri ___ 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] Delete node using e5x inline.
List, Does anyone know how to delete nodes from an xml using ex4 and a condition specific in the node. I really need to delete these nodes. For example: var tXML:XML = new XML( ) var pXML:XMLList = tXML.image_conf; When i then use this: delete pXML.randomImage.(attribute("delete") == "true")[0] Not all the nodes with @delete = 'true' are removed. trace(pXML.toXMLString()) // this is what is the output looks like Much appreciated. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] SmartyPants IOC
Hello, is there anybody on this list that has been using the SmartyPants, a dependency injection framework. I am curious to hear their experience with it. The documentation is _very_ limited, unfortunatly, and I am having a hard time getting my head around it. http://code.google.com/p/smartypants-ioc/ Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] mxmlc include classes , possible???
Hello list, Is it possible to force the mxmlc compiler to include certain classes so they can be instantiated at runtime. So I dont have to put an explicit reference in the .as files, in order to include it. I thought there was a compiler flag called include-classes, but a google search yields nothing of any use. I tried putting this in my flex-config org.name.class But I get an error. Doing a mxmlc -help advanced in the console also yields no such flag. So I wonder now, is it at all possible, or do i need to create a .swc and have that add to the librart tag? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Conditional statement in [Embed(source="... tag
Thanx, i will look into that. Jiri Ian Thomas wrote: It does accept conditionals, sort of, using the mxmlc -define tag. I blogged about it somewhere (hunts around). Aha! http://code.awenmedia.com/node/34 HTH, Ian On Tue, Apr 28, 2009 at 8:41 PM, Merrill, Jason wrote: I don't believe you can do conditionals with [Embed] statements. Those are compile-time directives for the compiler, not runtime player logic like an if/else. If the compiler accepts conditionals of some sort, I am not aware of it and don't think it's documented anywhere. I could be wrong, but I doubt this is possible. Jason Merrill Bank of America Global Learning Shared Services Solutions Development Monthly meetings on the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community ___ 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] Conditional statement in [Embed(source="... tag
So, you could do something like this in an embed tag [Embed(source="Arial-Rounded-MT-Bold.ttf", fontFamily="ArialRoundedBold", fontWeight="bold", mimeType="application/x-font-truetype", unicodeRange=getCodeRange()] Will try it. Cheers for replying. Sidney de Koning wrote: Hi Jiri, Why do you want to do that conditional there? Cant you call a var? Then in your main entry class you set that var depending on the lang you get in. Idea? Or if you work with some sort of MVC ( Model View Controller ) architecture you could do that conditional in your Model and in your Emdbed tag just query MainModel.getUnicodeRange() which returns a string of all appropriate unicode chars. Let me know if this works, Sid On Apr 28, 2009, at 5:47 PM, Jiri wrote: Hello list, i was wondering if it is possible to set a conditional statement in the EMBED tag. I would like to set the unicode range based on an id. Here is the class i have now: package { import flash.display.Sprite; public class ArialRoundedBoldFont extends Sprite { [Embed(source="Arial-Rounded-MT-Bold.ttf", fontFamily="ArialRoundedBold", fontWeight="bold", mimeType="application/x-font-truetype", unicodeRange="U+0020-U+017E,U+20A0-U+20CF")] public static var font:Class; } } I would like to achive that the var unicodeRange="U+0020-U+017E,U+20A0-U+20CF" is something like unicodeRange=((lang==id)? "U+0020-U+017E,U+20A0-U+20CF" : "U+0020-U+017E") Is this possible, or do I need to write a pre parser, generating the .as file with the correct unicodeRange for a specific language. Then compile all the .as files for each individual country? Many thanks, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Sidney de Koning - be a geek, in rockstar style! Flash / AIR Developer @ www.funky-monkey.nl Technical Writer @ www.insideria.com ___ 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] Conditional statement in [Embed(source="... tag
Hello list, i was wondering if it is possible to set a conditional statement in the EMBED tag. I would like to set the unicode range based on an id. Here is the class i have now: package { import flash.display.Sprite; public class ArialRoundedBoldFont extends Sprite { [Embed(source="Arial-Rounded-MT-Bold.ttf", fontFamily="ArialRoundedBold", fontWeight="bold", mimeType="application/x-font-truetype", unicodeRange="U+0020-U+017E,U+20A0-U+20CF")] public static var font:Class; } } I would like to achive that the var unicodeRange="U+0020-U+017E,U+20A0-U+20CF" is something like unicodeRange=((lang==id)? "U+0020-U+017E,U+20A0-U+20CF" : "U+0020-U+017E") Is this possible, or do I need to write a pre parser, generating the .as file with the correct unicodeRange for a specific language. Then compile all the .as files for each individual country? Many thanks, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Adobe AIR Mailing List?
I will join to :) J Steve Mathews wrote: Start your own, I will join! :) On Thu, Apr 23, 2009 at 10:27 AM, Steven Sacks wrote: Anyone know of an active Adobe AIR mailing list (like Flashcoders/Flash Tiger)? Apollocoders is basically dead, and all posts are moderated. ___ 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] ColorTransform GTween
He Cor, the question is. I want to tween a clip its color to a certain hex Value. So the equivalent of this in TweenLite: TweenLite.to(mc, 1, {tint:0xff9900}); Cheers, Jiri Cor wrote: No, yours. Yes it does flicker, but as I said, I don't think I understand the question correctly. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: vrijdag 10 april 2009 18:12 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween Cor, does it really works. I get a flickering. That is my clip is during the period of transition changing color very rapidly and then ends with the color it should end with. What code did u use, the one Joel Stransky posted coltw:GTween = new GTween(theclip.transform.colorTransform, 0.5, { > redOffset:255, greenOffset:255, blueOffset:255 }, { ease:Circular.easeOut } > ); > coltw.setAssignment(theclip.transform, "colorTransform"); Jiri Cor wrote: @jiri, OK, got the classes, and it transforms OK. Or maybe I don't understand the problem? Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: vrijdag 10 april 2009 17:35 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween That's what I had, but then for hex value, resulting in a flickering, probably because it sets back the color through the setAssigment.. import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); Quess I will need to do the calculations to the offsets by hand then. I tought, like all the other tween engines, a to hex value would be easy to do. @cor, thank you for the offer to send you the .fla, but pasting the code above would be the same. Jiri Paul Venton wrote: Taken a look at the comments on here: http://www.gskinner.com/blog/archives/2008/08/gtween_a_new_tw.html after a quick search on Google. coltw:GTween = new GTween(theclip.transform.colorTransform, 0.5, { redOffset:255, greenOffset:255, blueOffset:255 }, { ease:Circular.easeOut } ); coltw.setAssignment(theclip.transform, "colorTransform"); I've not tested it since I use TweenLite/Max - it should at least give you some idea. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: 10 April 2009 10:39 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween Is there really nobody that knows how to do it? Jiri Karl DeSaulniers wrote: Oh yeah, TweenLite is really easy and a realy great class. TweenMax too. They definately have tween for color. And MUCH more. Worth its weight in gold. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 8, 2009, at 7:27 PM, Muzak wrote: but is there really nobody out there who knows how to do it ? I'm sure Mr. Google knows. http://www.google.com/search?hl=en&q=tween+colortransform&meta=&aq=1&oq=twee n+color And I'm pretty sure AnimationPackage has some color stuff. http://www.alex-uhlmann.de/flash/animationpackage/ - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Wednesday, April 08, 2009 8:11 PM Subject: Re: [Flashcoders] ColorTransform GTween Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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] ColorTransform GTween
Cor, does it really works. I get a flickering. That is my clip is during the period of transition changing color very rapidly and then ends with the color it should end with. What code did u use, the one Joel Stransky posted coltw:GTween = new GTween(theclip.transform.colorTransform, 0.5, { > redOffset:255, greenOffset:255, blueOffset:255 }, { ease:Circular.easeOut } > ); > coltw.setAssignment(theclip.transform, "colorTransform"); Jiri Cor wrote: @jiri, OK, got the classes, and it transforms OK. Or maybe I don't understand the problem? Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: vrijdag 10 april 2009 17:35 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween That's what I had, but then for hex value, resulting in a flickering, probably because it sets back the color through the setAssigment.. import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); Quess I will need to do the calculations to the offsets by hand then. I tought, like all the other tween engines, a to hex value would be easy to do. @cor, thank you for the offer to send you the .fla, but pasting the code above would be the same. Jiri Paul Venton wrote: Taken a look at the comments on here: http://www.gskinner.com/blog/archives/2008/08/gtween_a_new_tw.html after a quick search on Google. coltw:GTween = new GTween(theclip.transform.colorTransform, 0.5, { redOffset:255, greenOffset:255, blueOffset:255 }, { ease:Circular.easeOut } ); coltw.setAssignment(theclip.transform, "colorTransform"); I've not tested it since I use TweenLite/Max - it should at least give you some idea. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: 10 April 2009 10:39 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween Is there really nobody that knows how to do it? Jiri Karl DeSaulniers wrote: Oh yeah, TweenLite is really easy and a realy great class. TweenMax too. They definately have tween for color. And MUCH more. Worth its weight in gold. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 8, 2009, at 7:27 PM, Muzak wrote: but is there really nobody out there who knows how to do it ? I'm sure Mr. Google knows. http://www.google.com/search?hl=en&q=tween+colortransform&meta=&aq=1&oq=twee n+color And I'm pretty sure AnimationPackage has some color stuff. http://www.alex-uhlmann.de/flash/animationpackage/ - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Wednesday, April 08, 2009 8:11 PM Subject: Re: [Flashcoders] ColorTransform GTween Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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 No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.287 / Virus Database: 270.11.49/2050 - Release Date: 04/09/09 19:01:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/
Re: [Flashcoders] ColorTransform GTween
That's what I had, but then for hex value, resulting in a flickering, probably because it sets back the color through the setAssigment.. import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); Quess I will need to do the calculations to the offsets by hand then. I tought, like all the other tween engines, a to hex value would be easy to do. @cor, thank you for the offer to send you the .fla, but pasting the code above would be the same. Jiri Paul Venton wrote: Taken a look at the comments on here: http://www.gskinner.com/blog/archives/2008/08/gtween_a_new_tw.html after a quick search on Google. coltw:GTween = new GTween(theclip.transform.colorTransform, 0.5, { redOffset:255, greenOffset:255, blueOffset:255 }, { ease:Circular.easeOut } ); coltw.setAssignment(theclip.transform, "colorTransform"); I've not tested it since I use TweenLite/Max - it should at least give you some idea. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Sent: 10 April 2009 10:39 To: Flash Coders List Subject: Re: [Flashcoders] ColorTransform GTween Is there really nobody that knows how to do it? Jiri Karl DeSaulniers wrote: Oh yeah, TweenLite is really easy and a realy great class. TweenMax too. They definately have tween for color. And MUCH more. Worth its weight in gold. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 8, 2009, at 7:27 PM, Muzak wrote: but is there really nobody out there who knows how to do it ? I'm sure Mr. Google knows. http://www.google.com/search?hl=en&q=tween+colortransform&meta=&aq=1&oq=twee n+color And I'm pretty sure AnimationPackage has some color stuff. http://www.alex-uhlmann.de/flash/animationpackage/ - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Wednesday, April 08, 2009 8:11 PM Subject: Re: [Flashcoders] ColorTransform GTween Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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] ColorTransform GTween
Is there really nobody that knows how to do it? Jiri Karl DeSaulniers wrote: Oh yeah, TweenLite is really easy and a realy great class. TweenMax too. They definately have tween for color. And MUCH more. Worth its weight in gold. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 8, 2009, at 7:27 PM, Muzak wrote: but is there really nobody out there who knows how to do it ? I'm sure Mr. Google knows. http://www.google.com/search?hl=en&q=tween+colortransform&meta=&aq=1&oq=tween+color And I'm pretty sure AnimationPackage has some color stuff. http://www.alex-uhlmann.de/flash/animationpackage/ - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Wednesday, April 08, 2009 8:11 PM Subject: Re: [Flashcoders] ColorTransform GTween Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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] ColorTransform GTween
Thanks everybody, I am aware of all these other tween packages, but I am exploring GTween at the moment. So it is not so much a question of how to tween color with a Tween Package, but more how to do it with GTween, because Google was not showing me any results on that. I geuss not so many people are using GTween, especially not for color tranformations. Jiri Karl DeSaulniers wrote: Oh yeah, TweenLite is really easy and a realy great class. TweenMax too. They definately have tween for color. And MUCH more. Worth its weight in gold. Karl DeSaulniers Design Drumm http://designdrumm.com On Apr 8, 2009, at 7:27 PM, Muzak wrote: but is there really nobody out there who knows how to do it ? I'm sure Mr. Google knows. http://www.google.com/search?hl=en&q=tween+colortransform&meta=&aq=1&oq=tween+color And I'm pretty sure AnimationPackage has some color stuff. http://www.alex-uhlmann.de/flash/animationpackage/ - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Wednesday, April 08, 2009 8:11 PM Subject: Re: [Flashcoders] ColorTransform GTween Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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] ColorTransform GTween
Thanx Ashum...,but is there really nobody out there who knows how to do it ? Jiri Ashim D'Silva wrote: Never used GTween before, but Grant is joining forces with Jack Doyle of TweenLite, and that library is incredibly easy to use. If the possibility exists, you might want to switch libraries, and soon, you should get the best of both worlds. 2009/4/9 Jiri : I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ 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] ColorTransform GTween
I am experimenting with GTween from Grant Skinner. I cant seem to figure out how to do a color transform. Does somebody know how to do that? Here is what i have: import fl.motion.easing.*; import com.gskinner.motion.* var colorInfo:ColorTransform = clip.transform.colorTransform; trace(colorInfo); var myTween:GTween = new GTween(clip,2,{color:0xFFcc00}); myTween.setAssignment(clip.transform,"colorTransform"); //resulting in flickering of color of the clip. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Bitwise selection
So each element in a ByteArray can hold 8 bits. What about the readInt() method of the ByteArray, does an integer then span over 4 elements of the bytearray. And if I start at position 0 and then call the readInt(), is the position after that then 4? Jiri Kerry Thompson wrote: Jiri wrote: Nice, that you took the time to write that post. It is much appreciated. Thanks, Jiri. One other thing worth mentioning is that an integer is actually 4 bytes, so you have 32 bits. I kept my example to one byte for simplicity. If you want to do operations on a single byte, you can use ByteArray elements. Other bitwise operators to check out are XOR (exclusive OR, which means one or the other is on, but not both) and shift operators >> and << to check the value of a particular bit. Cordially, Kerry Thompson ___ 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] Bitwise selection
Nice, that you took the time to write that post. It is much appreciated. Jiri Kerry Thompson wrote: Jiri has gotten some good answers. I got to work late today after working until 11:30 last night meeting my 5:00 deadline :-P I did occur to me that a fair number of us may not completely grok bitwise stuff. That's computer science stuff, and a lot of us got here by other routes-I see a lot of C programmers doing bitwise stuff, but relatively few AS programmers (at least, we don't talk about it a lot). Still, it can be blazingly fast, so when you have a need for speed, they are great. So I thought I'd talk a little about bit operations. If you already understand them, no need to read further (unless you wish to check my accuracy). First, the basics. We all probably know this, but a byte is no more than a series of on-off switches, or bits--eight of them on most modern computers. On is represented by 1, off by 0. So, a byte with every other bit on would be 10101010. When you do a bitwise operation, you are comparing bits. The bitwise OR operator, | , compares bits. If either of them is on (1), the result is 1. If both are off (0), the result is 0. Consider the following: 120 | 96 Compares 10101010 and 0110, giving the result 11101010 (234 decimal). Visually, this may help: 10101010 0110 11101010 We get that result because the | operator compares each bit. If either of them is on, the result is 1 for that bit. The AND operator & is similar in that it compares bit by bit, but both bits have to be on to get a 1 result. Comparing the same two numbers as before, 120 & 96, gives you the result 0010, or 32 decimal. 10101010 0110 00101010 Sometimes we use these as flags, where every bit can represent a Boolean value. They also can be used for fast math operations (check out http://lab.polygonal.de/2007/05/10/bitwise-gems-fast-integer-math/ This barely scratches the surface of bitwise operators and their power, but I hope it intrigues some of you enough to pursue it further. Cordially, Kerry Thompson ___ 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] Bitwise selection
Thanks for the helpfull feedback Mark Winterhalder wrote: Jiri, if() isn't too bad, especially since you will possibly want to permit multiple restrictions (like numbers /and/ letters, or Latin letters plus umlauts). If you use if() and combine that with appending to the restriction instead of setting it (+= instead of =), you gain flexibility. That way, you could also split lower case and upper case letter restrictions, and introduce a case insensitive restriction that is set to (UPPER_CASE | LOWER_CASE) -- it would have both bits set, so it would "hit" for both tests and append the restrictions to the "a-z A-Z " you already have now. That's just one example, the idea is not to have a fixed number of selections, but "groups" that you can switch on bit by bit, plus some predefined combinations (like the case insensitive letter example) for convenience. Also, don't test (restriction & 2), but (restriction & NUM_ONLY). That way, it's more readable, and you don't have to change all 2s if you decide to reorder your flags. Even more pedantic :), test ((restriction & NUM_ONLY) == NUM_ONLY) so you don't run into problems if you want to have flags that have multiple bits set later on. HTH, Mark On Thu, Apr 2, 2009 at 12:08 PM, Jiri wrote: I am new to bitwise operators, so I am trying to learn it. I have the following code and it works half. I am using a switch case to get the result, but this is messing things up. I could revert to and if - else statement, but I was wondering if there is a more elagant way of doing it. I post my code below, and would have some advice. var NO_RESTRICTION:int = 1; var NUM_ONLY:int = 2; var CHAR_ONLY:int = 4; var RESTRICTION:int = NUM_ONLY ; function setInputCharRestriction(tInt:int):void { RESTRICTION = tInt | tInt&2 | tInt&3; } function getRestrict():String{ var tRestrict:String = ''; trace('all ' , Boolean(RESTRICTION&1)) trace('num ' , Boolean(RESTRICTION&2)) trace('char ' ,Boolean(RESTRICTION&4)) switch(RESTRICTION){ case RESTRICTION&1 : tRestrict +="\u0020-\u007E"; trace('all') case RESTRICTION&2: tRestrict =" 0-9"; trace('num') case RESTRICTION&4: tRestrict =" A-Z a-z"; trace('char') } trace('restrict field ' , tRestrict) return tRestrict; } getRestrict() Thank you. Jiri ___ 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] Bitwise selection
Thanks Hans, I am aware of that, so if-else would be the only way to go I guess. Jiri Hans Wichman wrote: Hi, isn't the absence of break statements messing things up? greetz JC On Thu, Apr 2, 2009 at 12:08 PM, Jiri wrote: I am new to bitwise operators, so I am trying to learn it. I have the following code and it works half. I am using a switch case to get the result, but this is messing things up. I could revert to and if - else statement, but I was wondering if there is a more elagant way of doing it. I post my code below, and would have some advice. var NO_RESTRICTION:int = 1; var NUM_ONLY:int = 2; var CHAR_ONLY:int = 4; var RESTRICTION:int = NUM_ONLY ; function setInputCharRestriction(tInt:int):void { RESTRICTION = tInt | tInt&2 | tInt&3; } function getRestrict():String{ var tRestrict:String = ''; trace('all ' , Boolean(RESTRICTION&1)) trace('num ' , Boolean(RESTRICTION&2)) trace('char ' ,Boolean(RESTRICTION&4)) switch(RESTRICTION){ case RESTRICTION&1 : tRestrict +="\u0020-\u007E"; trace('all') case RESTRICTION&2: tRestrict =" 0-9"; trace('num') case RESTRICTION&4: tRestrict =" A-Z a-z"; trace('char') } trace('restrict field ' , tRestrict) return tRestrict; } getRestrict() Thank you. Jiri ___ 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] Bitwise selection
I am new to bitwise operators, so I am trying to learn it. I have the following code and it works half. I am using a switch case to get the result, but this is messing things up. I could revert to and if - else statement, but I was wondering if there is a more elagant way of doing it. I post my code below, and would have some advice. var NO_RESTRICTION:int = 1; var NUM_ONLY:int = 2; var CHAR_ONLY:int = 4; var RESTRICTION:int = NUM_ONLY ; function setInputCharRestriction(tInt:int):void { RESTRICTION = tInt | tInt&2 | tInt&3; } function getRestrict():String{ var tRestrict:String = ''; trace('all ' , Boolean(RESTRICTION&1)) trace('num ' , Boolean(RESTRICTION&2)) trace('char ' ,Boolean(RESTRICTION&4)) switch(RESTRICTION){ case RESTRICTION&1 : tRestrict +="\u0020-\u007E"; trace('all') case RESTRICTION&2: tRestrict =" 0-9"; trace('num') case RESTRICTION&4: tRestrict =" A-Z a-z"; trace('char') } trace('restrict field ' , tRestrict) return tRestrict; } getRestrict() Thank you. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Storing x and y in a bytearray
Hittest is to expensive, i try to avoid it at all times. J Hans Wichman wrote: ah no then you'll be fine ! Although if it's just a simple shape, hittest will work as well of course, depending on the performance you need. On Mon, Mar 30, 2009 at 1:52 PM, Jiri wrote: On stage there is a draw shape. I copy it to BitmapData and use the transparancy for testing walkable or not. So i dont use compressed image format, just raw bitmap data. Or am i missing something? Jiri Hans Wichman wrote: yup exactly, only thing is that I'm not sure how detailed this info can be when using compressed image formats... On Mon, Mar 30, 2009 at 1:13 PM, Jiri wrote: Good point, i can use getPixel to retrieve the color value and based on that 'know' if it is walkable. Cheers. Jiri Hans Wichman wrote: Hi, why not use an image? Eg use an image that represents your area, lookup the pixel values, AND them and decide what you can or cannot do in that area. greetz JC On Mon, Mar 30, 2009 at 12:41 PM, Jiri wrote: I have a byte question. I have to store a walkable area so a character 'knows' where it can walk or not. Currently I am using a multi-dim array based on the x and y pos of the tiles . so [[1],[0],[1]..etc] where pos(0,0) => array[0][0] => 1 (walkable) I was wondering if I could store this using a bytearray, for storing and possibly faster lookup using bitwise operators. I am very knew to this, so I am ot sure where to begin and how to deal with it. The range of int is sufficient to store all the data, because a full walkarea would take 370560 (772*480) elements in the previous mentioned multi array. I could be completely wrong, but would like some advice. Jiri ___ 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 ___ 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] Storing x and y in a bytearray
On stage there is a draw shape. I copy it to BitmapData and use the transparancy for testing walkable or not. So i dont use compressed image format, just raw bitmap data. Or am i missing something? Jiri Hans Wichman wrote: yup exactly, only thing is that I'm not sure how detailed this info can be when using compressed image formats... On Mon, Mar 30, 2009 at 1:13 PM, Jiri wrote: Good point, i can use getPixel to retrieve the color value and based on that 'know' if it is walkable. Cheers. Jiri Hans Wichman wrote: Hi, why not use an image? Eg use an image that represents your area, lookup the pixel values, AND them and decide what you can or cannot do in that area. greetz JC On Mon, Mar 30, 2009 at 12:41 PM, Jiri wrote: I have a byte question. I have to store a walkable area so a character 'knows' where it can walk or not. Currently I am using a multi-dim array based on the x and y pos of the tiles . so [[1],[0],[1]..etc] where pos(0,0) => array[0][0] => 1 (walkable) I was wondering if I could store this using a bytearray, for storing and possibly faster lookup using bitwise operators. I am very knew to this, so I am ot sure where to begin and how to deal with it. The range of int is sufficient to store all the data, because a full walkarea would take 370560 (772*480) elements in the previous mentioned multi array. I could be completely wrong, but would like some advice. Jiri ___ 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] Storing x and y in a bytearray
Good point, i can use getPixel to retrieve the color value and based on that 'know' if it is walkable. Cheers. Jiri Hans Wichman wrote: Hi, why not use an image? Eg use an image that represents your area, lookup the pixel values, AND them and decide what you can or cannot do in that area. greetz JC On Mon, Mar 30, 2009 at 12:41 PM, Jiri wrote: I have a byte question. I have to store a walkable area so a character 'knows' where it can walk or not. Currently I am using a multi-dim array based on the x and y pos of the tiles . so [[1],[0],[1]..etc] where pos(0,0) => array[0][0] => 1 (walkable) I was wondering if I could store this using a bytearray, for storing and possibly faster lookup using bitwise operators. I am very knew to this, so I am ot sure where to begin and how to deal with it. The range of int is sufficient to store all the data, because a full walkarea would take 370560 (772*480) elements in the previous mentioned multi array. I could be completely wrong, but would like some advice. Jiri ___ 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] Storing x and y in a bytearray
I have a byte question. I have to store a walkable area so a character 'knows' where it can walk or not. Currently I am using a multi-dim array based on the x and y pos of the tiles . so [[1],[0],[1]..etc] where pos(0,0) => array[0][0] => 1 (walkable) I was wondering if I could store this using a bytearray, for storing and possibly faster lookup using bitwise operators. I am very knew to this, so I am ot sure where to begin and how to deal with it. The range of int is sufficient to store all the data, because a full walkarea would take 370560 (772*480) elements in the previous mentioned multi array. I could be completely wrong, but would like some advice. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question on ByteArray acces.
I tried your solution and it works! > var pixelPos:int = col + row * totalCols; // or x + y * widthOfOriginalBitmap > buffer.position = pixelPos * 4;// each pixel takes 32 bits ==> 4 bytes > var pixelValue:uint = buffer.readUnsignedInt(); For the archives. The totalCols var is the width of the bitmap. Juan Pablo Califano wrote: Have you tried something like this? var pixelPos:int = col + row * totalCols; // or x + y * width buffer.position = pixelPos * 4;// each pixel takes 32 bits ==> 4 bytes var pixelValue:uint = buffer.readUnsignedInt(); Or, if the order is column-major (but I don't think it is) var pixelPos:int = row + col * totalRows; // or y + x * height buffer.position = pixelPos * 4;// each pixel takes 32 bits ==> 4 bytes var pixelValue:uint = buffer.readUnsignedInt(); Cheers Juan Pablo Califano 2009/3/17, Jiri : Seems that the encoder use the BitmapData.getPixel(). So that doesnt give me the insight I am hoping for :( J. Romuald Quantin wrote: I guess you need some kind of specification, how the bytes for a bitmapdata are created and stored. I have no idea if you can find that. Basically they're doing that in the JPGEncoder andPNGEncoder? You might want to see what they're doing to get some details about what is stored and where. http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/JPGEncoder.as http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/PNGEncoder.as Romu Jiri wrote: Hello, I have a BitmapData and use the draw() method to add sprite data. Then I get the ByteArray through the BitmapData.getPixels() method. This byteArray is compressed and cached. Then when i need it, i decompress the ByteArray and use the BitmapData.setPixels() and add all that to a new Bitmap() Next I use the Bitmap.getPixel(MouseX , MouseY) to check if the pixel is white or not. White meaning I cannot 'walk' there. My question is, can I skip the adding of the ByteArray to the Bitmap and directly access the value corresponding to the x and y in the ByteArray. This would probably save me some computation time. How are the bytes stored, is it a multi dimensional array and if so, what is the colum size? Thank you, Jiri ___ 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] Question on ByteArray acces.
Thank you , i will try it tommorrow and let you know if that worked. I am just wondering if there is no begin offset in the ByteArray. So maybe I should not start at position=0. Do you know something about that, anyway I will try and see tomorrow. Jiri Juan Pablo Califano wrote: Have you tried something like this? var pixelPos:int = col + row * totalCols; // or x + y * width buffer.position = pixelPos * 4;// each pixel takes 32 bits ==> 4 bytes var pixelValue:uint = buffer.readUnsignedInt(); Or, if the order is column-major (but I don't think it is) var pixelPos:int = row + col * totalRows; // or y + x * height buffer.position = pixelPos * 4;// each pixel takes 32 bits ==> 4 bytes var pixelValue:uint = buffer.readUnsignedInt(); Cheers Juan Pablo Califano 2009/3/17, Jiri : Seems that the encoder use the BitmapData.getPixel(). So that doesnt give me the insight I am hoping for :( J. Romuald Quantin wrote: I guess you need some kind of specification, how the bytes for a bitmapdata are created and stored. I have no idea if you can find that. Basically they're doing that in the JPGEncoder andPNGEncoder? You might want to see what they're doing to get some details about what is stored and where. http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/JPGEncoder.as http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/PNGEncoder.as Romu Jiri wrote: Hello, I have a BitmapData and use the draw() method to add sprite data. Then I get the ByteArray through the BitmapData.getPixels() method. This byteArray is compressed and cached. Then when i need it, i decompress the ByteArray and use the BitmapData.setPixels() and add all that to a new Bitmap() Next I use the Bitmap.getPixel(MouseX , MouseY) to check if the pixel is white or not. White meaning I cannot 'walk' there. My question is, can I skip the adding of the ByteArray to the Bitmap and directly access the value corresponding to the x and y in the ByteArray. This would probably save me some computation time. How are the bytes stored, is it a multi dimensional array and if so, what is the colum size? Thank you, Jiri ___ 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] Question on ByteArray acces.
Seems that the encoder use the BitmapData.getPixel(). So that doesnt give me the insight I am hoping for :( J. Romuald Quantin wrote: I guess you need some kind of specification, how the bytes for a bitmapdata are created and stored. I have no idea if you can find that. Basically they're doing that in the JPGEncoder andPNGEncoder? You might want to see what they're doing to get some details about what is stored and where. http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/JPGEncoder.as http://code.google.com/p/as3corelib/source/browse/trunk/src/com/adobe/images/PNGEncoder.as Romu Jiri wrote: Hello, I have a BitmapData and use the draw() method to add sprite data. Then I get the ByteArray through the BitmapData.getPixels() method. This byteArray is compressed and cached. Then when i need it, i decompress the ByteArray and use the BitmapData.setPixels() and add all that to a new Bitmap() Next I use the Bitmap.getPixel(MouseX , MouseY) to check if the pixel is white or not. White meaning I cannot 'walk' there. My question is, can I skip the adding of the ByteArray to the Bitmap and directly access the value corresponding to the x and y in the ByteArray. This would probably save me some computation time. How are the bytes stored, is it a multi dimensional array and if so, what is the colum size? Thank you, Jiri ___ 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] Question on ByteArray acces.
Hello, I have a BitmapData and use the draw() method to add sprite data. Then I get the ByteArray through the BitmapData.getPixels() method. This byteArray is compressed and cached. Then when i need it, i decompress the ByteArray and use the BitmapData.setPixels() and add all that to a new Bitmap() Next I use the Bitmap.getPixel(MouseX , MouseY) to check if the pixel is white or not. White meaning I cannot 'walk' there. My question is, can I skip the adding of the ByteArray to the Bitmap and directly access the value corresponding to the x and y in the ByteArray. This would probably save me some computation time. How are the bytes stored, is it a multi dimensional array and if so, what is the colum size? Thank you, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Strange behaviour ByteArray to BitmapData object
Thank you. The position=0 seems to do the trick. I actually read over it in the documentation. RTFM should be RTFMW(ell) !! :) > Little tips if you want to test, instead of using setPixels to "fill" > your Bitmap, using graphics.beginBitmapFill seems quicker and less CPU > intensive (test it, I'm not 100% sure). I dont actually want to render the bitmap. I make a black and white images of a hand drawn sprite, that acts as a walkarea. Every room has a different area and so i cache the ByteArray for every room. This 'bumpmap' is used to check, with getPixel() if a clicked position is on the walkmap. If I would render it to a graphics I will loose the getPixel() method for checking. Also when i use the Loader.loadBytes. Or am i wrong? Jiri Romuald Quantin wrote: Did you try myByteArray.position = 0 before reading it ? You can try to use a Loader.loadBytes to instantiate a Bitmap (it uses a loader but it takes no time). Do you load the picture before storing the bytes? If it is helping, I built a loader that is storing bytes for a cache system and use Loader.loadBytes to instantiate the Bitmap: http://www.soundstep.com/blog/downloads/somaloader/ To be sure your ByteArray is compressed, you can: bytes.position = 0; var compressed:uint = bytes.readUnsignedByte(); if (compressed == 0x43) trace("ByteArray is compressed!") Little tips if you want to test, instead of using setPixels to "fill" your Bitmap, using graphics.beginBitmapFill seems quicker and less CPU intensive (test it, I'm not 100% sure). Romu Jiri wrote: I came across some very weird behaviour and I can't seem to find an explanation for it. I am trying to write a class that will store compressed ByteArrays that are retreive throught the bitmapData.getPixels. Here is some testing code, that I wrote for the testing if a decompressed ByteArray can be parsed back into an Bitmapdata object. It all works well if the uncompress/compress block is in the code. When i comment that code out, I get this error: Could someone tell me what is happening here? Error: Error #2030: End of file was encountered. at flash.display::BitmapData/setPixels() at GreyFilter_fla::MainTimeline/frame1() import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Point; import flash.geom.Rectangle; var destPoint:Point = new Point(); var source:Sprite = getChildByName('mcWalkArea') as Sprite; var sourceRect:Rectangle = new Rectangle(0, 0, source.width, source.height); var a:BitmapData = new BitmapData(sourceRect.width, sourceRect.height); var storedMapData:ByteArray; a.draw( source ); //create a black and white area. a.threshold(a, sourceRect, destPoint , "!=", 0x , 0xFF00 ); storedMapData = a.getPixels(sourceRect); /* Try uncommenting this trace(storedMapData.length); storedMapData.compress() trace(storedMapData.length); storedMapData.uncompress() trace(storedMapData.length); */ var tData:BitmapData = new BitmapData(sourceRect.width , sourceRect.height) tData.setPixels( sourceRect , storedMapData ); var i:int = 0 while(i < source.width){ trace( tData.getPixel(i , 0 ) ) i++ } Jiri ___ 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] Strange behaviour ByteArray to BitmapData object
I came across some very weird behaviour and I can't seem to find an explanation for it. I am trying to write a class that will store compressed ByteArrays that are retreive throught the bitmapData.getPixels. Here is some testing code, that I wrote for the testing if a decompressed ByteArray can be parsed back into an Bitmapdata object. It all works well if the uncompress/compress block is in the code. When i comment that code out, I get this error: Could someone tell me what is happening here? Error: Error #2030: End of file was encountered. at flash.display::BitmapData/setPixels() at GreyFilter_fla::MainTimeline/frame1() import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Point; import flash.geom.Rectangle; var destPoint:Point = new Point(); var source:Sprite = getChildByName('mcWalkArea') as Sprite; var sourceRect:Rectangle = new Rectangle(0, 0, source.width, source.height); var a:BitmapData = new BitmapData(sourceRect.width, sourceRect.height); var storedMapData:ByteArray; a.draw( source ); //create a black and white area. a.threshold(a, sourceRect, destPoint , "!=", 0x , 0xFF00 ); storedMapData = a.getPixels(sourceRect); /* Try uncommenting this trace(storedMapData.length); storedMapData.compress() trace(storedMapData.length); storedMapData.uncompress() trace(storedMapData.length); */ var tData:BitmapData = new BitmapData(sourceRect.width , sourceRect.height) tData.setPixels( sourceRect , storedMapData ); var i:int = 0 while(i < source.width){ trace( tData.getPixel(i , 0 ) ) i++ } Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RegExp headache
Everybody thank you! Jiri Merrill, Jason wrote: Seriously, just play with RegExr / Regex Buddy, get the cheat sheets: Am now - love it! Can't I still be in awe? :) Jason Merrill Bank of America | Learning Performance Solutions Instructional Technology & Media Learn about the Adobe Flash platform for rich media experiences - join the Bank of America Flash Platform Community Anyone can follow my nonsense on Twitter: jmerrill_2001. If you know me personally, follow more nonsense on Facebook. ___ 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] RegExp headache
I would like some help on a regExp I have a string and want to split it into the first character being a <|>|<=|>=|== the second part being an int. so ">100" would return result[1] = '>' result[2] = 100 so "100" would return result[1] = 'undefined' result[2] = 100 Here is what I have so far, but it is killing me. var pattern:RegExp = /^(\d)?(^\d+)|()/ var result:Object = pattern.exec(tConditionalString); I tried another approach but i am still figuring out how to do it. It goes something like this var pattern:RegExp = /^(>):((?(2)then|else)) Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Gumbo and E4x
Maybe try this._interface_xml..*.(@type == name)@label Jiri Lori Hutchek wrote: Hey All, I have a simple xml search that I'm doing to retrieve some attributes. But when trying to use gumbo no results are returned. I know this is working in the Flex 3 SDK. Is this a bug or have they changed something? Here's the code: this._interface_xml.*.(@type == name)@label Anyone else having this problem? Thanks! Lori- ___ 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] Help jsfl traceBitmap
For the archive. This is the way to do it. function convert(tFlaPath , tExportPath , tFilename){ debugMessage += "\n Vectorizing file :" + tFilename + " on " + (new Date()).toGMTString() + "\n"; debugMessage += "SettingstraceBitmap(100, 2, 'normal' , 'normal') \n"; fl.openDocument(tFlaPath); fl.outputPanel.clear(); var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; var tLayerN; if (item.itemType == 'movie clip') { var timeline = item.timeline; len = timeline.frameCount; tLayerN = timeline.layers.length; for(var p=0; p This one threw me off a bit :) You have to move the timeline playhead for traceBitmap to work. When you enter edit mode, you automatically end up in the first frame, so that's why traceBitmap works for the first frame, and not the others. So, loop through the number of frames, set "timeline.currentFrame" and then you'll be able to select the elements in that frame and work with them. This should do the trick: var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); var i = items.length; var item; var timeline; var len; var fr; while (i--) { item = items[i]; fl.trace("itemType: " + item.itemType); if (item.itemType == "movie clip") { library.selectItem(item); library.editItem(); timeline = item.timeline; len = timeline.frameCount; fl.trace("- frameCount: " + timeline.frameCount); for(var j=0; jhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Help jsfl traceBitmap
> This one threw me off a bit :) Tell me about it, it did my head in all day.. > When you enter edit mode, you automatically end up in the first frame, That explains why, although looping through the frames, it was always only the first one to be converted before the error was thrown. I will give your suggestion a try tomorrow and cross my fingers it works. Thank you again. jiri Muzak wrote: This one threw me off a bit :) You have to move the timeline playhead for traceBitmap to work. When you enter edit mode, you automatically end up in the first frame, so that's why traceBitmap works for the first frame, and not the others. So, loop through the number of frames, set "timeline.currentFrame" and then you'll be able to select the elements in that frame and work with them. This should do the trick: var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); var i = items.length; var item; var timeline; var len; var fr; while (i--) { item = items[i]; fl.trace("itemType: " + item.itemType); if (item.itemType == "movie clip") { library.selectItem(item); library.editItem(); timeline = item.timeline; len = timeline.frameCount; fl.trace("- frameCount: " + timeline.frameCount); for(var j=0; jhttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Help jsfl traceBitmap
Muzak and others, everything worked fine, but now i am struggling with movieclips and different frames on their timeline containing 1 png. I followed your described logic. 1. go trhrough lib items. 2. Check if it is a movieclip. 3. For framecount of the timeline, do a loop. 4. For each frame get the elemtens 5. add this to the selection 6. apply the trace bitmap. 7. ERROR! Selcection not set Would someone please be so kind to take a look...it is driving me nuts! Thnx function convert(tFlaPath , tExportPath){ fl.openDocument(tFlaPath); var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items; i = items.length; while (i--) { var item = items[i]; if (item.itemType == 'movie clip') { var timeline = item.timeline; var k = timeline.frameCount; library.selectItem(item); library.editItem(); while(k--){ var j = timeline.layers[0].frames[k].elements.length while(j--){ doc.selection = timeline.layers[0].frames[k].elements doc.traceBitmap(100, 1, 'normal', 'normal'); } } doc.exitEditMode(); } } filename_new = getNewFileName(filename); targetPath = tExportPath + "/" + filename_new.toUpperCase1() + ".swf" //doc.exportSWF(targetPath, true); //doc.close(false); } Muzak wrote: This should work, but should probably build in a few more "checks" in the loop. Like check if there's a bitmap in the currently editted movieclip in the specified frame. What this does is: - loop through the items in the library - check if current item is a movieclip (not a bitmap as you did) - if movieclip, select it and enter edit mode - get the movieclip timeline and set the elements in its first frame/first layer as document selection // here is where you should check if the above selection contains a bitmap - trace bitmap var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; fl.trace("itemType: " + item.itemType); if (item.itemType == 'movie clip') { library.selectItem(item); library.editItem(); var timeline = item.timeline; fl.trace("- frameCount: " + timeline.frameCount); doc.selection = timeline.layers[0].frames[0].elements; doc.traceBitmap(100, 1, 'pixels', 'normal'); } } doc.exitEditMode(); regards, Muzak - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Monday, February 09, 2009 9:47 AM Subject: [Flashcoders] Help jsfl traceBitmap Hello, i was wondering if someone can help me out with the following. I have a the maintimeline with on it a movieclip. Inside this movieclip is a png, that I would like to trace as a bitmap. I can't seem to target the png that is nested in the movieclip. If i understand correctly I will first need to get it the timeline of the png holder clip from the library and then select the frame. Here is my code which throws a "selection: Argument number 1 is invalid." var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; if (item.itemType == 'bitmap') { var imageName = item.name.split('.')[0]; var image = doc.getTimeline().layers[0].frames[0].elements[0]; doc.selection = image doc.traceBitmap(100, 100 , 'normal' , 'normal'); } } Hope someone can help! Jiri ___ ___ 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] Help jsfl traceBitmap
Thnx a million ! J Muzak wrote: This should work, but should probably build in a few more "checks" in the loop. Like check if there's a bitmap in the currently editted movieclip in the specified frame. What this does is: - loop through the items in the library - check if current item is a movieclip (not a bitmap as you did) - if movieclip, select it and enter edit mode - get the movieclip timeline and set the elements in its first frame/first layer as document selection // here is where you should check if the above selection contains a bitmap - trace bitmap var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; fl.trace("itemType: " + item.itemType); if (item.itemType == 'movie clip') { library.selectItem(item); library.editItem(); var timeline = item.timeline; fl.trace("- frameCount: " + timeline.frameCount); doc.selection = timeline.layers[0].frames[0].elements; doc.traceBitmap(100, 1, 'pixels', 'normal'); } } doc.exitEditMode(); regards, Muzak - Original Message - From: "Jiri" To: "Flash Coders List" Sent: Monday, February 09, 2009 9:47 AM Subject: [Flashcoders] Help jsfl traceBitmap Hello, i was wondering if someone can help me out with the following. I have a the maintimeline with on it a movieclip. Inside this movieclip is a png, that I would like to trace as a bitmap. I can't seem to target the png that is nested in the movieclip. If i understand correctly I will first need to get it the timeline of the png holder clip from the library and then select the frame. Here is my code which throws a "selection: Argument number 1 is invalid." var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; if (item.itemType == 'bitmap') { var imageName = item.name.split('.')[0]; var image = doc.getTimeline().layers[0].frames[0].elements[0]; doc.selection = image doc.traceBitmap(100, 100 , 'normal' , 'normal'); } } Hope someone can help! Jiri ___ ___ 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] Help jsfl traceBitmap
Hello, i was wondering if someone can help me out with the following. I have a the maintimeline with on it a movieclip. Inside this movieclip is a png, that I would like to trace as a bitmap. I can't seem to target the png that is nested in the movieclip. If i understand correctly I will first need to get it the timeline of the png holder clip from the library and then select the frame. Here is my code which throws a "selection: Argument number 1 is invalid." var doc = fl.getDocumentDOM(); var library = doc.library; var items = library.items.concat(); i = items.length; while (i--) { var item = items[i]; if (item.itemType == 'bitmap') { var imageName = item.name.split('.')[0]; var image = doc.getTimeline().layers[0].frames[0].elements[0]; doc.selection = image doc.traceBitmap(100, 100 , 'normal' , 'normal'); } } Hope someone can help! Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Socket connection between two air applications on the same Network Area
Couldn't HaXe a good candidate for a solution? Omar Fouad wrote: Hi all, I wanted to ask if there is a way to let two AIR applications connect to each other through a home network (the same AIR application running on different computers) by using sockets or any other method. Thanks. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] round number to closet value of 8
Indeed it looks very impressive. Could some explain what is does exactly? Hans Wichman wrote: very cool! On Thu, Dec 18, 2008 at 4:26 PM, Benjamin Wolsey wrote: Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman: Hi, I think you are looking for : function roundToEight (pVal:Number) { return Math.round(pVal/8)<<3; } although 44.9 and 44.4 will both return 48, don't you mean 43.9 and 44.4? int(pVal + 4) &~ 7; will also do it. -- Free Flash, use Gnash http://www.gnu.org/software/gnash/ Benjamin Wolsey, Software Developer - http://benjaminwolsey.de ___ 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] round number to closet value of 8
Thank you all. :) Benjamin Wolsey wrote: Am Donnerstag, den 18.12.2008, 16:13 +0100 schrieb Hans Wichman: Hi, I think you are looking for : function roundToEight (pVal:Number) { return Math.round(pVal/8)<<3; } although 44.9 and 44.4 will both return 48, don't you mean 43.9 and 44.4? int(pVal + 4) &~ 7; will also do it. -- Free Flash, use Gnash http://www.gnu.org/software/gnash/ Benjamin Wolsey, Software Developer - http://benjaminwolsey.de ___ 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] round number to closet value of 8
Thnx that seems to work good enough. 44. is rounded to 48 and should be 40, but thats fine. Thnx again. Jiri Lehr, Ross (N-SGIS) wrote: I think Math.round(Math.round(32.3/8)) * 8 -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Heitlager Sent: Thursday, December 18, 2008 8:55 AM To: Flash Coders List Subject: [Flashcoders] round number to closet value of 8 I am trying to figure out the fastest way to get the closest multitude of 8 from a random Number and I am really not a math person. var tN:Number = 32.3 //32 var tN:Number = 32.00 //32 var tN:Number = 44.9 //48 var tN:Number = 44.4 //40 Much appreciated if someone could help me out Jiri ___ 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] round number to closet value of 8
I am trying to figure out the fastest way to get the closest multitude of 8 from a random Number and I am really not a math person. var tN:Number = 32.3 //32 var tN:Number = 32.00 //32 var tN:Number = 44.9 //48 var tN:Number = 44.4 //40 Much appreciated if someone could help me out Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Pixel precise
Math should be avoided when possible, I believe it is quit slow. Maybe Number >> 0 is even faster for rounding of ;) Jiri laurent wrote: int( ) is casting the content to integer, it has the effect to drop off the decimal part. Same as Math.floor but lots faster L Cor a écrit : If the sprite.x is not an exact round number (so not an correct integer) wouldn't that throw an error??? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jiri Heitlager Sent: woensdag 17 december 2008 15:11 To: Flash Coders List Subject: Re: [Flashcoders] Pixel precise Casting to int is faster. var tX:int = int(sprite.x) Jiri jonathan howe wrote: Hi, Laurent, You could use localToGlobal(), apply Math.round() to this global point, compare the original global point with the rounded version, and then offset the child's coordineates by the differences. Caveats are: - if you do this multiple places in a display hierarchy, you'd need to work from the bottom upwards. - during animation you're bound to introduce a certain amount of jumpiness. On Wed, Dec 17, 2008 at 8:39 AM, laurent wrote: Hi, Is there a way to be sure elements are positionned précisely on a Pixel ? I have a sprite containing sprites that are positionned on integer coordinates so they are pixel positionned. And this sprite is re-positionned when the window resize, so I used int() to be sure I got x and y as integers but still the content get blury sometimes. Is there something to do that flash always position element on a pixel not a pixel and half...? thx L ___ 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 - http://www.avg.com Version: 8.0.176 / Virus Database: 270.9.19/1853 - Release Date: 17-12-2008 8:31 ___ 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] Pixel precise
Casting to int is faster. var tX:int = int(sprite.x) Jiri jonathan howe wrote: Hi, Laurent, You could use localToGlobal(), apply Math.round() to this global point, compare the original global point with the rounded version, and then offset the child's coordineates by the differences. Caveats are: - if you do this multiple places in a display hierarchy, you'd need to work from the bottom upwards. - during animation you're bound to introduce a certain amount of jumpiness. On Wed, Dec 17, 2008 at 8:39 AM, laurent wrote: Hi, Is there a way to be sure elements are positionned précisely on a Pixel ? I have a sprite containing sprites that are positionned on integer coordinates so they are pixel positionned. And this sprite is re-positionned when the window resize, so I used int() to be sure I got x and y as integers but still the content get blury sometimes. Is there something to do that flash always position element on a pixel not a pixel and half...? thx L ___ 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] What design pattern would this be?
I also still find it sometimes hard when to decide what pattern to use and mostly _if_ I should use a pattern. It helps me a lot to really think about what the responsibility is of a class and then when I notice it has more then one, then that is an inidicator I need to refine more. Sometimes refining means that I _can_ use a pattern, it doesnt always mean that I should use one. I think these are those things that take a long time of experience. Good luck. Jiri Joel Stransky wrote: Thanks Jiri, I had not seen that site. I had assumed the book covered all of the patterns I was going to need but in hindsight that was silly. The visitor pattern seems very similar to adapter however. I guess I've got a lot of learning to do. I appreciate the notion of not over engineering but until I understand them fluently I intend to implement patterns where possible no matter how trite. On Sun, Dec 7, 2008 at 5:26 AM, Jiri Heitlager <[EMAIL PROTECTED] wrote: Maybe this one: http://www.as3dp.com/2008/12/06/actionscript-30-visitor-design-pattern-a-tale-of-traverser-and-the-double-dispatch-kid/ or check out the articles there I am sure there is a pattern described that will suit your needs. I also think the previous comment on overenginering should be taking into consideration.. Good luck, Jiri Joel Stransky wrote: Thanks for your perfectly useless answer. I know if I could recognize the need for certain patterns easily I'd be more than happy to help out rather than chastise.It looks like it's possibly a Template pattern but I was hoping for the same kind of insight I've been giving at flashkit for eight years no matter how simple the question. On Sat, Dec 6, 2008 at 10:29 PM, Latcho <[EMAIL PROTECTED]> wrote: Are you gonna take a map if you have clear line of sight to your destination ? Shall we advise you on traffic light implementation if you are the only driver in the world ? Dont' overengineer. If you want to integrate / learn a design pattern take a more challenging and/or interactive interface. Latcho Joel Stransky wrote: I'm trying to make design patterns a regular part of my process but understanding them and knowing which one to use are proving to be a quite different. I'm working on a couple of classes. One class's job is to iterate over a list of display objects and modify their scale and location based on mouse position. I want this class to be able to work with a runtime generated OR an authortime generated display list. I figure it's as easy as instantiating either a RuntimeChildren or AuthortimeChildren class and passing it to the constructor of my DisplayListUtility class. Since it's so simple, does it even qualify as a design pattern and if so which one? ___ 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] What design pattern would this be?
Maybe this one: http://www.as3dp.com/2008/12/06/actionscript-30-visitor-design-pattern-a-tale-of-traverser-and-the-double-dispatch-kid/ or check out the articles there I am sure there is a pattern described that will suit your needs. I also think the previous comment on overenginering should be taking into consideration.. Good luck, Jiri Joel Stransky wrote: Thanks for your perfectly useless answer. I know if I could recognize the need for certain patterns easily I'd be more than happy to help out rather than chastise.It looks like it's possibly a Template pattern but I was hoping for the same kind of insight I've been giving at flashkit for eight years no matter how simple the question. On Sat, Dec 6, 2008 at 10:29 PM, Latcho <[EMAIL PROTECTED]> wrote: Are you gonna take a map if you have clear line of sight to your destination ? Shall we advise you on traffic light implementation if you are the only driver in the world ? Dont' overengineer. If you want to integrate / learn a design pattern take a more challenging and/or interactive interface. Latcho Joel Stransky wrote: I'm trying to make design patterns a regular part of my process but understanding them and knowing which one to use are proving to be a quite different. I'm working on a couple of classes. One class's job is to iterate over a list of display objects and modify their scale and location based on mouse position. I want this class to be able to work with a runtime generated OR an authortime generated display list. I figure it's as easy as instantiating either a RuntimeChildren or AuthortimeChildren class and passing it to the constructor of my DisplayListUtility class. Since it's so simple, does it even qualify as a design pattern and if so which one? ___ 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] E4x replace nodename
Hello list, i make the following query on an xml file to retrieve a list with certain node names: var tXML:XML = <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> var pat:RegExp = new RegExp('findname' , 'i') var tList:XMLList = tXML.*.(pat['test'](name())) This works fine, but know i would like to in addition to finding them also remove the 'findname_' I could use this: var tList:XMLList = tXML.*.(pat['test'](name())).(editNodeName(name())) function editNodeName(tObj:String):void{ trace('-> ',tObj); } And then create a new XMLlist with custom nodes. But how do I access the currentNode in the query instead of the name(). Or is it possible to directly do a regExp replace on the node? Thnx Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] OT: smoothd.com
Nice Meinte van't Kruis wrote: has anyone checked out http://www.smoothhd.com/ seems pretty cool, here's the description; SmoothHD.com is an early glimpse of cutting edge new technology from Microsoft and Akamai that will raise the bar on the consumer video experience. SmoothHD.com is powered by Microsoft Internet Information Server (IIS) 7.0 Smooth Streaming – a unique adaptive streaming technology that dynamically adapts video quality in real-time based on local bandwidth conditions - and Akamai AdaptiveEdge Streaming for Microsoft(R) Silverlight™ , a new solution for enabling high-quality, scalable video experiences over Akamai's global HTTP network of more than 36,000 servers around the world. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] runtime instantiation
I know it is possible to instantiate a class at runtime, but one always needs to put in a concrete piece of code that forces the compiler to actually add the class to the swf. I am currently looking into using this technique to gain flexibility in an application, but the fact that I will always need to add concrete code to force the compiler seems to be counter productive. Here is what I have. interface aInterface class abstractA impl aInterface class injectedB extends abstractA class injectedC extends abstractA then I have a factory method that reads an xml file and instantitated a class based on the @reference node using getDefinitionByName() My idea is that I can in the future write an new class injectedC and just add it to the xml list. But this won't work because I will always need to add something like this to var foo:injectedC = null to add the class to the compiler. Meaning I will always need to recompile. Is there any way to get around this? Jiri artur wrote: need to know a few things: 1 - can i render/export to QT an AS based animation that will be 40min long? it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will trigger different AS animations made from an XML file. is there a chance that the animation and sound can become out of sync ( this has been known to happen with timeline based animations ) 2 - the FLV will have over 10k cuepoints. is there a way to "Scrub through" to the middle of the animation by giving an ID# to each CuePoint? and then giving each XML node that same ID#? then just create a simple textfield form and have the client enter that ID# and the animation can Jump to that section of the animation ( for testing/previewing ) but then how can the client add/delete cuepoints in the FLV and have them be resorted numerically? so they can match the xml IDs? im sure there is a clever & flexible solution out there..anyone? thanks! p.s. i need to do this in AS2..if possible. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Question on architectural problem.
Dear List, I am having a architectural problem and would like to ask people on this list for some input. The project that I am working on uses several models, we call them proxies,i.e RemoteProxy, GameProxy etc... They all extends a base class Proxy and implement an IProxy interface. The chances are in the future more proxies will be added. The person that build the system gave every Proxy an getInfo Method, the method looks like this getInfo(sIdentifier:String) : Object. Where every return object needs to be typecast to the expected return type. The reason of this function is that custom methods can be called from a proxy. This creates flexibility but comes with a price. The compiler can't check it. I can understand the reasons why this method is implementated, not having a zillion extended interfaces, not having to add import etc. But I would like to know if some solution excists that deals with this in an elegant way. I read about the Bridge pattern, but I am not sure if this will help me? Thank you. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Question e4x attributes text replace
Thanx Ian, that sounds like a very clever solution. I will give it a try, and speedoh well I geuss it can always be faster ;) Jiri Ian Thomas wrote: Convert the XML to a string. Do the regExp replace on the string. Reparse the XML? e.g. var str:String=xml.toXMLString(); // do replacement here... xml=new XML(str); Might not be the fastest in the world, depending on the amount of XML you are parsing, but it'll do the job. HTH, Ian On Thu, Oct 9, 2008 at 5:56 PM, Jiri Heitlager <[EMAIL PROTECTED]> wrote: Hello, I have this xml file that I would like to filter on a certain string $$lang$$ and I was wondering if it is possible in one go using regExp instead of looping through an XMLList var conf:XML = I know it is possible to do inline functions but could get the current node and then replace the text var processed:XMLList = conf..*.(test(attributes()) ); function test(tValue:Object):void { trace('called' , tValue) } In this case how do I get acces to the current XMLList and change the $$lang$$ for another string Hope somebody can help me out. Jiri ___ 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] Question e4x attributes text replace
Hello, I have this xml file that I would like to filter on a certain string $$lang$$ and I was wondering if it is possible in one go using regExp instead of looping through an XMLList var conf:XML = I know it is possible to do inline functions but could get the current node and then replace the text var processed:XMLList = conf..*.(test(attributes()) ); function test(tValue:Object):void { trace('called' , tValue) } In this case how do I get acces to the current XMLList and change the $$lang$$ for another string Hope somebody can help me out. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Retreive name of function within scope of that function
Thank you all for the helpfull reply. JIri Juan Pablo Califano wrote: A rather dirty way is to enumerate all methods in a given object (the current timeline, for instance) and compare that to the "self-reference" that a function holds in arguments.callee. u function test():void { trace(getName(arguments.callee,this)); } function getName(funcRef:Function,scope:*):String { var funcName:String = ""; var desc:XML = flash.utils.describeType(this); var methodTable:XMLList = desc..method.(@name != "" && @name != null); for each (var item:XML in methodTable){ if([EMAIL PROTECTED] == funcRef) { funcName = [EMAIL PROTECTED]; break; } } return funcName; } test(); It's just a quick and dirty test, but it works (at least in the timeline). Cheers Juan Pablo Califano 2008/9/16 Jiri Heitlager <[EMAIL PROTECTED]> Does somebody now if it is possible to get the name of a function from the scope of that function. function doSomething():void { trace('the name of this function is ' , $$name$$) } Where the trace would be : the name of this function is doSomething In Java one has acces to stack traces, does AS3 provide acces to this? Jiri ___ 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] Retreive name of function within scope of that function
Does somebody now if it is possible to get the name of a function from the scope of that function. function doSomething():void { trace('the name of this function is ' , $$name$$) } Where the trace would be : the name of this function is doSomething In Java one has acces to stack traces, does AS3 provide acces to this? Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AMF objects storing in database
I came across a post on storing custom classes as an AMF object. It explains how to do the following. "If you ever need to store the state of a custom object in a ByteArray or SharedObject, or send a custom object through a LocalConnection, there are a few simple steps you can take that will allow your object's state to be serialised (converted to AMF) and preserved for future restoration. " src: http://www.si-robertson.com/go/serialise-custom-classes I wanted to know, can I then just send the AMF object to a server and store it as a binary in a mysql database? And also is this adviceable? Thank you, Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] What's happened to my var?
Or add onCompleteScope:this so you dont need to import Delegate class. TweenFilterLite.to(m, tweenTime, {_y:targetPos, onCompleteScope:this , onComplete:moveShape, onCompleteParams:[_timeline.y1]}); Jiri Ali Drongo wrote: Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace("moveShape:"+m+" up:"+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace("moveDir:"+moveDir); trace("moveAmt:"+moveAmt); trace("target:"+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ 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] Saffron Modeler - what happened to it
That seems very promising. I really hope that the saffron will be released, becuase it looked promising when I saw a presentation about it at FITC. Ali Drongo wrote: I believe there's an open source collaboration that has been started to create something like Saffron. There's different rumours as to what is happening with Saffron so this group is building it's own: http://flair-flash-flex-air.blogspot.com/2008/04/open-source-saffron-like-uml-tool.html Ali On 30 Jun 2008, at 17:11, Sidney de Koning wrote: there is loads of activity on sam's twitter account http://twitter.com/SamuelAgesilas S. On Jun 30, 2008, at 6:05 PM, Jiri Heitlager wrote: Does somebody know what happend to the saffron UML modelling tool. The site http://www.levelofindustry.com/ is not showing any update anymore. Jiri ___ 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] Saffron Modeler - what happened to it
Does somebody know what happend to the saffron UML modelling tool. The site http://www.levelofindustry.com/ is not showing any update anymore. Jiri ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Document viewer
I don't think that Adobe is especially interested in promoting FlashPaper, which is essentially a competitor or substitute for PDF. What a same, because it has some nice features. Come to think of it, now with the PDF isnt possible to embed flash content and doesnt that open up a way to do some interesting flash stuff with a pdf. Jiri Dave Watts wrote: It has been a year ago and I'd thought Adobe would have brrought out an update by now. Geuss not! I don't think that Adobe is especially interested in promoting FlashPaper, which is essentially a competitor or substitute for PDF. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ___ 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] Document viewer
It has been a year ago and I'd thought Adobe would have brrought out an update by now. Geuss not! The problem I then had was that the client had word docs that contained a table of index. Some links would get destroyed when a doc had more then I thikn 100+ pages. Also href links would get destroyed. It was a disaster and we ended up splicing the docs.. I would really advice testing with the biggest doc you have. Jiri Stuart Campbell wrote: Really? Some of my docs will be 200 pages long. What problems did you have exactly? I'm also having "fun" because I thought FlashPaper would allow me to restrict copy and paste and printing. But it only seems to do that for PDF output. Quite dissapointed that Adobe haven't taken FlashPaper forward. On Fri, Jun 27, 2008 at 12:25 PM, Jiri Heitlager < [EMAIL PROTECTED]> wrote: Be carefull with huge documents in Flash Paper. I had some serious issues with that in the past. Jiri Stuart Campbell wrote: @Eric: Thanks. Downloading the trial now. @Paul - yeah screengrabs aren't considered a problem (the documents are so huge that nobody is likely to bother). On Thu, Jun 26, 2008 at 2:07 PM, Paul Venton <[EMAIL PROTECTED]> wrote: I take it they're not worried about the user taking screen grabs and email those off? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stuart Campbell Sent: 26 June 2008 13:23 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Document viewer Hi, I have a project where I need the client to be able to view documents in the browser (PDF, Word, RTF and Excel). However, the requirement is that the person viewing the document can never save the file and can never get their hands on it in order to email it to someone etc. It seems to me that a Flash viewer would be well suited to this kind of control. However I am not quite sure how to go about it. Is there a Flash implementation of a viewer that supports these file formats? Would I need to pre-process the files and put them into swf format? Has anybody had to do anything similar? Many thanks in advance Stu ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Document viewer
Be carefull with huge documents in Flash Paper. I had some serious issues with that in the past. Jiri Stuart Campbell wrote: @Eric: Thanks. Downloading the trial now. @Paul - yeah screengrabs aren't considered a problem (the documents are so huge that nobody is likely to bother). On Thu, Jun 26, 2008 at 2:07 PM, Paul Venton <[EMAIL PROTECTED]> wrote: I take it they're not worried about the user taking screen grabs and email those off? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stuart Campbell Sent: 26 June 2008 13:23 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Document viewer Hi, I have a project where I need the client to be able to view documents in the browser (PDF, Word, RTF and Excel). However, the requirement is that the person viewing the document can never save the file and can never get their hands on it in order to email it to someone etc. It seems to me that a Flash viewer would be well suited to this kind of control. However I am not quite sure how to go about it. Is there a Flash implementation of a viewer that supports these file formats? Would I need to pre-process the files and put them into swf format? Has anybody had to do anything similar? Many thanks in advance Stu ___ 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] Flip movie clip
Is the center point in the middle? Jiri Bassam M wrote: Hi I have Video playing in the center of the stage and I'm using button to filp it function filp(event:MouseEvent):void { mySampleMC.scaleY *= -1; } mySampleMC.addEventListener(MouseEvent.CLICK, flip); but the problem when I flip it change Y postion and go up , I wnat to flip it and keep it in same postion Help please Thanks Bassam ___ 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] Job offer in Berlin (ActionScript)
He Abe, I am a Dutch Flash developer and I am living in Berlin since 1 year now. Your email sounds quit interesting and I would like to get to know a bit more. Could you send me some more details. Thank you, Jiri Heitlager Abe Pazos wrote: The company where I work is growing and needs more AS3 developers. The project is called Panfu, one of the biggest virtual worlds for children, developed in AS3 and PureMVC. It's a large and young international team with programmers, designers, illustrators, translators, moderators and many others. Work conditions are quite good I think. Berlin is a great city to live in, specially in summer. It's full of cultural events, parks where you can relax, lakes, and people coming from all countries. You can go around with bicycle or using a very efficient public transportation. Flats and food are quite inexpensive compared to other large cities. For more details or for sending a CV please use my e-mail address. Hopefully one of you is working here with us soon! :) Abe ps. I'm sending this job offer to the list as it was said a couple of weeks ago it is ok to do so. Hopefully it does not upset anyone. ___ 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] Question AIR Sqlite api
Thanx Muzak, I will try your solution Muzak wrote: I think I had a similar error when one of the statements wasn't valid. In this case I'd think that one of the tables already exists (which ends the transaction) and when the next statement is exectuted it throws the error you see. Here's something I used: try { _sqlConnection.begin(); // // sql statements here // _sqlConnection.commit(); }catch(e:SQLError) { trace("- message; ", e.message); trace("- details: ", e.details); _sqlConnection.rollback(); } } When creating a table it is a good idea to check if the table already exists. 'CREATE TABLE IF NOT EXISTS ...' regards, Muzak - Original Message - From: "Jiri Heitlager" <[EMAIL PROTECTED]> To: "Flash Coders List" Sent: Friday, April 18, 2008 10:19 AM Subject: Re: [Flashcoders] Question AIR Sqlite api OK, I relplied a bit in a hurry and didnt make myself clear. That is stupid of me, and I am sorry. The situation is like so. I open a connection using OpenAsync. I have listeners listening to the Open event. When that is fired, I response with a method that creates 3 tables in one go, see code below. I keep getting an error, also shown below. If in the whole story I use open instead of openAsync, everything works perfect. I have now idea why that is?? Error: Error #3105: Operation is only allowed if a connection has an open transaction. at Error$/throwError() at flash.data::SQLConnection/commit() at classes.models::SQLProxy/createDatabase()[/Users/Jiri/Documents/_Flash/SmsApp/SmsApplication/src/classes/models/SQLProxy.as:128] Debug session terminated. private function createDatabase(e:Event):void { Sql_conn.addEventListener(SQLEvent.COMMIT , onDatabaseCreated); Sql_conn.begin(); var createTable:SQLStatement = new SQLStatement() createTable.sqlConnection = Sql_conn createTable.text = 'CREATE TABLE contacts (index_id INTEGER PRIMARY KEY , name TEXT , phone NUMBER )'; createTable.execute(); var createErrors:SQLStatement = new SQLStatement() createErrors.sqlConnection = Sql_conn createErrors.text = 'CREATE TABLE errors (index_id INTEGER PRIMARY KEY , error_id INTEGER , type TEXT )'; createErrors.execute(); var createArchive:SQLStatement = new SQLStatement() createArchive.sqlConnection = Sql_conn createArchive.text = 'CREATE TABLE sms_archive (index_id INTEGER PRIMARY KEY , sms TEXT , receiver NUMBER , sender NUMBER )'; createArchive.execute(); Sql_conn.commit(); } Muzak wrote: Then I'm not sure I understand what your problem is. You said it works when using openAsync().. The weird thing is that when I use openAsync instead of open, it does work? - Original Message - From: "Jiri Heitlager" <[EMAIL PROTECTED]> To: "Flash Coders List" Sent: Thursday, April 17, 2008 10:52 PM Subject: Re: [Flashcoders] Question AIR Sqlite api weird...I will have to look into that and see if there is a work around, because I would really like to work with openAsync. J. Muzak wrote: Because when adding listeners you are implying asynchronous mode. In other words, as soon as you add listeners, you have to use openAsync(). I've found the use of synchronous mode to be alot easier. regards, Muzak ___ 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] Question AIR Sqlite api
OK, I relplied a bit in a hurry and didnt make myself clear. That is stupid of me, and I am sorry. The situation is like so. I open a connection using OpenAsync. I have listeners listening to the Open event. When that is fired, I response with a method that creates 3 tables in one go, see code below. I keep getting an error, also shown below. If in the whole story I use open instead of openAsync, everything works perfect. I have now idea why that is?? Error: Error #3105: Operation is only allowed if a connection has an open transaction. at Error$/throwError() at flash.data::SQLConnection/commit() at classes.models::SQLProxy/createDatabase()[/Users/Jiri/Documents/_Flash/SmsApp/SmsApplication/src/classes/models/SQLProxy.as:128] Debug session terminated. private function createDatabase(e:Event):void { Sql_conn.addEventListener(SQLEvent.COMMIT , onDatabaseCreated); Sql_conn.begin(); var createTable:SQLStatement = new SQLStatement() createTable.sqlConnection = Sql_conn createTable.text = 'CREATE TABLE contacts (index_id INTEGER PRIMARY KEY , name TEXT , phone NUMBER )'; createTable.execute(); var createErrors:SQLStatement = new SQLStatement() createErrors.sqlConnection = Sql_conn createErrors.text = 'CREATE TABLE errors (index_id INTEGER PRIMARY KEY , error_id INTEGER , type TEXT )'; createErrors.execute(); var createArchive:SQLStatement = new SQLStatement() createArchive.sqlConnection = Sql_conn createArchive.text = 'CREATE TABLE sms_archive (index_id INTEGER PRIMARY KEY , sms TEXT , receiver NUMBER , sender NUMBER )'; createArchive.execute(); Sql_conn.commit(); } Muzak wrote: Then I'm not sure I understand what your problem is. You said it works when using openAsync().. The weird thing is that when I use openAsync instead of open, it does work? - Original Message - From: "Jiri Heitlager" <[EMAIL PROTECTED]> To: "Flash Coders List" Sent: Thursday, April 17, 2008 10:52 PM Subject: Re: [Flashcoders] Question AIR Sqlite api weird...I will have to look into that and see if there is a work around, because I would really like to work with openAsync. J. Muzak wrote: Because when adding listeners you are implying asynchronous mode. In other words, as soon as you add listeners, you have to use openAsync(). I've found the use of synchronous mode to be alot easier. regards, Muzak ___ 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] Question AIR Sqlite api
weird...I will have to look into that and see if there is a work around, because I would really like to work with openAsync. J. Muzak wrote: Because when adding listeners you are implying asynchronous mode. In other words, as soon as you add listeners, you have to use openAsync(). I've found the use of synchronous mode to be alot easier. regards, Muzak - Original Message - From: "Jiri Heitlager" <[EMAIL PROTECTED]> To: "Flash Coders List" Sent: Wednesday, April 16, 2008 5:02 PM Subject: [Flashcoders] Question AIR Sqlite api I have a question about SQLite and AIR. Does anybody know why I get this error, becuase the connection is open? I put the code below. The weird thing is that when I use openAsync instead of open, it does work? Error: Error #3105: Operation is only allowed if a connection has an open transaction. at Error$/throwError() at flash.data::SQLConnection/commit() at classes.models::SQLProxy/createDatabase()[/Users/Jiri/Documents/_Flash/SmsApp/SmsApplication/src/classes/models/SQLProxy.as:128] Debug session terminated. protected function build():void { Sql_db = File.applicationDirectory.resolvePath('TESTER.db') var exists:Boolean = Sql_db.exists if ( exists ) { Sql_conn.addEventListener(SQLEvent.OPEN , onDBStatementOpenResult); }else { Sql_conn.addEventListener(SQLEvent.OPEN , createDatabase); } Sql_conn.openAsync( Sql_db ) } private function createDatabase(e:Event):void { Sql_conn.addEventListener(SQLEvent.COMMIT , onDatabaseCreated); Sql_conn.begin(); var createTable:SQLStatement = new SQLStatement() createTable.sqlConnection = Sql_conn createTable.text = 'CREATE TABLE contacts (index_id INTEGER PRIMARY KEY , name TEXT , phone NUMBER )'; createTable.execute(); var createErrors:SQLStatement = new SQLStatement() createErrors.sqlConnection = Sql_conn createErrors.text = 'CREATE TABLE errors (index_id INTEGER PRIMARY KEY , error_id INTEGER , type TEXT )'; createErrors.execute(); var createArchive:SQLStatement = new SQLStatement() createArchive.sqlConnection = Sql_conn createArchive.text = 'CREATE TABLE sms_archive (index_id INTEGER PRIMARY KEY , sms TEXT , receiver NUMBER , sender NUMBER )'; createArchive.execute(); Sql_conn.commit(); } ___ 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