Re: [Flashcoders] Adding MC with some frames from library
Yes that works of course. But I am trying to understand why AS3 do this thing. What is wrong? Is it just bug? 2010/5/6 Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com: Duh, just realized I replied in the wrong thread. Got me why that's happening, but a fix: What about just saying nav.btnBack.gotoAndStop(1); nav.btnNext.gotoAndStop(1); From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya [natavi.m...@gmail.com] Sent: Wednesday, May 05, 2010 8:32 AM To: Flash Coders List Subject: [Flashcoders] Adding MC with some frames from library Hi I met situation with AS3 that I can not explain or even understand where I should look answer. Simple example. In library I have simple movie clip with linkage class name nav. This mc has mc2 with two frames. In frame 1- stop(). On the stage I add this nav function init():void{ var nav:Nav=new Nav(); nav.x=200; nav.y=200; addChild(nav); } init(); nav is on the stage correctly. Mc2 in frame 1. But if I use another way function init(e:Event):void{ var nav:Nav=new Nav(); nav.x=200; nav.y=200; addChild(nav); } btn.addEventListener(MouseEvent.CLICK,init); nav is on the stage but mc2 somehow stops in frame2. Please can anybody explain this situation? Thanks in advance. ___ 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] SIP library in as3 for player 10.1
Anthony Pace wrote: Anyone know of a working SIP library in AS3 for player 10.1? You mean that phone protocol? I don't think that is possible. At least not without AIR. For some bizare reason, UDP support is restricted to AIR. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
i agree with kenneth - swf address forms the basis of my navigation i take the current url from the swfaddress event in my model, pass it through a function to make sure the url exists and then dispatch the page change event to the rest of the application which updates the page view and the navigation a On 5 May 2010 19:28, Kenneth Kawamoto kennethkawam...@gmail.com wrote: If I understood you correctly, you want to filter the XML data according to a variable passed to the SWF. If so you'd do something like: var pageDetails:String = xmlData.PAGE.(@pg_name == loaderInfo.parameters.page).DETAILS; // page is the name of the var passed to the SWF here But I strongly recommend you to have a look at SWFAddress, which is absolutely indispensable framework if you are creating a site driven by dynamic data ;) Kenneth Kawamoto http://www.materiaprima.co.uk/ John Singleton wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ 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] Producing a random list with no repeats
I always use Fisher-Yates shuffle method to randomise an Array, which yields more unbiased result. http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle My AS3 interpretation of Fisher-Yates is as follows; I can just call this from anywhere in my scripts ;) package utils { public function fisherYates(arr:Array):void { var i:uint = arr.length; while(--i){ var j:uint = Math.floor(Math.random()*(i + 1)); var tmpI:Object = arr[i]; var tmpJ:Object = arr[j]; arr[i] = tmpJ; arr[j] = tmpI; } } } -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 6 May 2010 02:27, Juan Pablo Califano califa010.flashcod...@gmail.com wrote: A simple way: Put all the candidate numbers in a list (in this case, 1 to 40). Then pick randomly from that array, one at the time, and make sure you remove that number from the candidates list, so you can't have duplicates. In code (untested): function getRandomList():Array { var min:Number = 1; var max:Number = 40; var numItems:Number = 10; var candidates:Array = []; // fill up the candidates list with the eligible numbers for(var i:Number = min; i = max; i++) { candidates.push(i); } var list:Array = []; var idx:Number = 0; var selectedNumber:Number = 0; for(i = 0; i numItems; i++) { // get a number from the candidates list, randomly. Add it to the result and remove it from the candidates list (using splice) idx = Math.floor(Math.random() * candidates.length); selectedNumber = candidates.splice(idx,1)[0]; list.push(selectedNumber); } return list; } Cheers Juan Pablo Califano 2010/5/5 Alan Neilsen aneil...@gotafe.vic.edu.au I am working in ActionScript 2. I want to create a quiz in which 10 questions are randomly selected from a block of 40 questions. I found the following code, but I can't work out how to stop it doubling up the questions. function randRange(min:Number, max:Number):Number { var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randomNum; } for (var i = 0; i 10; i++) { var n:Number = randRange(1, 40) trace(n); } When I run this it outputs a list of numbers like 40 13 17 12 27 12 3 17 9 15 which means some questions (in this case 17 and 12) will appear twice in my quiz. Bearing in mind that I am a bit of an ActionScript dummy, can anybody suggest a way to modify the above script to prevent the same number being generated more than once. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Writing to text file
Is it possible to use flash to write to a text file (maybe an xml file)? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Writing to text file
Lehr, Theodore wrote: Is it possible to use flash to write to a text file (maybe an xml file)? You can write to user chosen files using the FileRefernce class. You can also use network comunication/ExternalInterface to cause other applications to write to files. If you use AIR, you have full freedom to write to any file without user intervention. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Writing to text file
Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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] SIP library in as3 for player 10.1
You may want to take a look at red5phone, if you haven't already: http://code.google.com/p/red5phone/ -- Andrew Murphy Interactive Media Developer amur...@delvinia.com Delvinia 370 King Street West, 5th Floor, Box 4 Toronto Canada M5V 1J9 P (416) 364-1455 ext. 232 F (416) 364-9830 W www.delvinia.com -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Anthony Pace Sent: May 5, 2010 20:02 pm To: Flash Coders List Subject: [Flashcoders] SIP library in as3 for player 10.1 Anyone know of a working SIP library in AS3 for player 10.1? ___ 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] Writing to text file
Perhaps my methodology is wrong - here is what I want to do: Say I have 100 links... I want to track which ones get clicked the most and have something like Top 10 links and have those be the ones that get clicked the most. My thought was to have a text file on the server that I can add to whenever a link gets clicked - so I would need to open and edit the text file when something is linked... This would all be easier with a database but that is not an option so I am trying to mimick on with a text file. any thoughts on how I could do this? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of ekameleon [ekamel...@gmail.com] Sent: Thursday, May 06, 2010 8:13 AM To: Flash Coders List Subject: Re: [Flashcoders] Writing to text file Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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] Writing to text file
import flash.net.FileReference; var s:XML = categorynode id=testHello/node/category; var file:FileReference = new FileReference(); file.save( s, testing.xml ); On Thu, May 6, 2010 at 8:13 AM, ekameleon ekamel...@gmail.com wrote: Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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 -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Writing to text file
Use PHP or something like that as middleware. However can more than one app instance run at the same time? On Thu, May 6, 2010 at 8:24 AM, Lehr, Theodore ted_l...@federal.dell.comwrote: Perhaps my methodology is wrong - here is what I want to do: Say I have 100 links... I want to track which ones get clicked the most and have something like Top 10 links and have those be the ones that get clicked the most. My thought was to have a text file on the server that I can add to whenever a link gets clicked - so I would need to open and edit the text file when something is linked... This would all be easier with a database but that is not an option so I am trying to mimick on with a text file. any thoughts on how I could do this? From: flashcoders-boun...@chattyfig.figleaf.com [ flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of ekameleon [ ekamel...@gmail.com] Sent: Thursday, May 06, 2010 8:13 AM To: Flash Coders List Subject: Re: [Flashcoders] Writing to text file Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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 -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Jason Merrill says he sent an earlier reply concerning my question about how to write my switch statement. No, I don't recall seeing it. I just resurrected it with Google, and thank you! This works: pageDetails = xmlData.PAGE.(@pg_name == contact).DETAILS.text(); Meanwhile, Kenneth Kawamoto recommends looking at SWFAddress. I am and like what I see. Thanks! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Writing to text file
not in a php environment - pretty much has to be a pure flash solution - if possible... From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Eric E. Dolecki [edole...@gmail.com] Sent: Thursday, May 06, 2010 8:34 AM To: Flash Coders List Subject: Re: [Flashcoders] Writing to text file Use PHP or something like that as middleware. However can more than one app instance run at the same time? On Thu, May 6, 2010 at 8:24 AM, Lehr, Theodore ted_l...@federal.dell.comwrote: Perhaps my methodology is wrong - here is what I want to do: Say I have 100 links... I want to track which ones get clicked the most and have something like Top 10 links and have those be the ones that get clicked the most. My thought was to have a text file on the server that I can add to whenever a link gets clicked - so I would need to open and edit the text file when something is linked... This would all be easier with a database but that is not an option so I am trying to mimick on with a text file. any thoughts on how I could do this? From: flashcoders-boun...@chattyfig.figleaf.com [ flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of ekameleon [ ekamel...@gmail.com] Sent: Thursday, May 06, 2010 8:13 AM To: Flash Coders List Subject: Re: [Flashcoders] Writing to text file Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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 -- http://ericd.net Interactive design and development ___ 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] XML Question
Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
http://www.w3schools.com/xml/xml_cdata.asp On 6 May 2010 14:56, John Singleton johnsingleton...@yahoo.com wrote: Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ 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] XML Question
Wrap your text with XML character data, i.e. DETAILS![CDATA[h3Senior Citizen Discount/h3... ]]/DETAILS -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 6 May 2010 13:56, John Singleton johnsingleton...@yahoo.com wrote: Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] One Video, multiple Audio tracks?
Is there a reliable way to have one video track, but then swap in audio tracks on the fly and have them sync properly? The client wants a 26 minute video which would be in English, but then also have 8 other language versions that would be dubbed, eg the audio would play over the video. We're trying to figure out if this can be done with a single video and multiple audio, or if it will need to be separate flv's. The reason for not just using different flv's is because the whole thing needs to fit on a CD-ROM so we're dealing with pretty significant size constraints if we want to fit it on one disc. And yes, before you point out that DVD's are exponentially larger than CD's, I know, but the discs will be sent to countries with much less reliability in terms of what kinds of drives they'll have and in all likelihood much higher percentages of users who are still running pc's with CD drives only, no DVD. I pushed for DVD, but lost. Anyhoo, any suggestions much appreciated. thanks, Matt ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Writing to text file
Lehr, Theodore wrote: not in a php environment - pretty much has to be a pure flash solution - if possible... Flash has no server power at all. It can make HTTP requests and do socket connections, that's it. No random file writing on other computers. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Doing a binary search in AS3?
I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. The part I'm not sure how to implement in a binary way is the part to ask the question, is 'pineapple' in the first list (apple, orange, banana, pear)? well, to figure that out, in Actionscript, I know of no other way but to either 1) loop through that first list item by item and see if you locate it - if you don't - then search the second list. Which defeats the purpose of a binary search - or 2) to use something like array.indexOf() - which is a lookup itself, and not a binary search - if you were to use that, you've already completed your search before you even get started Either way, you're defeating the purpose of a binary search. . You'd obviously use a recursive function to do a binary search, which I can write, but not sure exactly what that would look like. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Doing a binary search in AS3?
Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 6, 2010 9:08:22 AM Subject: Re: [Flashcoders] XML Question Wrap your text with XML character data, i.e. DETAILS![CDATA[h3Senior Citizen Discount/h3... ]]/DETAILS Thank you. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Doing a binary search in AS3?
Just compare the middle element, if it is bigger, use the left half, else use the right half. I don't follow - can you post an Actionscript example? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson Sent: Thursday, May 06, 2010 10:45 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ 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] Doing a binary search in AS3?
the most important thing being as Hendrik said that it is sorted, which in your example it is not. Say you have: [apple, banana, cherry, kiwi, orange, peach pear, pineapple, ] and you are looking for banana: middle element is orange (or kiwi) take apple, banana, cherry, kiwi, middle element is cherry take apple, banana middle element is banana yeah a hit My description is a bit shabby but you get the idea. Whether it beats a dictionary ... I don't think so, I've only done this when searching through huge sorted files with random file access, not with arrays in flash. regards Hans On Thu, May 6, 2010 at 4:44 PM, Henrik Andersson he...@henke37.cjb.netwrote: Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ 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] Producing a random list with no repeats
/** * Generates an array of random numbers from 1 or 0 to max where all numbers through max are used, and no number is zero (if specified). * Specify true if no zeros are to be included, specify false if zeros are to be included in the resulting array. * @param max the maximum range for the numbers. * @param useZero Specify true if no zeros are to be included, specify false if zeros are to be included in the resulting array. * @return an array of random numbers where no number is the same. * */ public static function rndNumArray(max:int, useZero:Boolean=false):Array { var array:Array = []; for (var i1:int = 0; i1 max; i1++) { array.push(); } var i2:int = 0; while (i2 array.length) { var rndNum:Number = rndNum(0, max); if (!containedInArray(rndNum, array) ) { //if (useZero) rndNum = rndNum-1; array[i2] = rndNum; i2++; } } if (useZero) { var arrLen:int = array.length; for (var i3:int = 0; i3 arrLen; i3++) { array[i3] = array[i3]-1; } } return array; } /** * Generates a random number within the given range. * * @example listing version=3.0 * var myRandomNumber:Number = rndNum(2, 13);br/ * trace(myRandomNumber); //returns 7 (a random between 2 and 13) * /listing * @param minVal the minimum number for the range. * @param maxVal the maxiumum number for the range. * @return returns the random number generated. * * */ public static function rndNum(minVal:Number, maxVal:Number):Number { return minVal + Math.floor(Math.random()*(maxVal+1-minVal)); } Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of kennethkawam...@gmail.com Sent: Thursday, May 06, 2010 5:03 AM To: Flash Coders List Subject: Re: [Flashcoders] Producing a random list with no repeats I always use Fisher-Yates shuffle method to randomise an Array, which yields more unbiased result. http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle My AS3 interpretation of Fisher-Yates is as follows; I can just call this from anywhere in my scripts ;) package utils { public function fisherYates(arr:Array):void { var i:uint = arr.length; while(--i){ var j:uint = Math.floor(Math.random()*(i + 1)); var tmpI:Object = arr[i]; var tmpJ:Object = arr[j]; arr[i] = tmpJ; arr[j] = tmpI; } } } -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 6 May 2010 02:27, Juan Pablo Califano califa010.flashcod...@gmail.com wrote: A simple way: Put all the candidate numbers in a list (in this case, 1 to 40). Then pick randomly from that array, one at the time, and make sure you remove that number from the candidates list, so you can't have duplicates. In code (untested): function getRandomList():Array { var min:Number = 1; var max:Number = 40; var numItems:Number = 10; var candidates:Array = []; // fill up the candidates list with the eligible numbers for(var i:Number = min; i = max; i++) { candidates.push(i); } var list:Array = []; var idx:Number = 0; var selectedNumber:Number = 0; for(i = 0; i numItems; i++) { // get a number from the candidates list, randomly. Add it to the result and remove it from the candidates list (using splice) idx = Math.floor(Math.random() * candidates.length); selectedNumber = candidates.splice(idx,1)[0]; list.push(selectedNumber); }
RE: [Flashcoders] XML Question
Jason Merrill says he sent an earlier reply concerning my question about how to write my switch statement. No, I don't recall seeing it. I just resurrected it with Google, and thank you! This works: Well, THAT's annoying (not your fault though)- do you see this reply? I hope I'm not being filtered because I work for Bank of America - wouldn't be the first time that's happened - I get a lot of e-mails I send lost because people send a lot of phishing spam using our company name. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Doing a binary search in AS3?
Merrill, Jason wrote: Just compare the middle element, if it is bigger, use the left half, else use the right half. I don't follow - can you post an Actionscript example? //warning, not fully correct, will infinity loop while(leftright) { var middle=(left+right)/2; var value=arr[middle]; if(valueneedle) { right=middle; } else { left=middle; } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Writing to text file
in the FP10 see the FileReference.save() method That's a bit misleading. You might want to also tell him what else he needs on the server side to use that. You can't just use FileReference to save an XML file on anyone's computer. FileReference won't let you write files locally from the Flash player - security restrictions. Use FileReference to save a XML file on a server using server-side scripting in addition. Or skip FileReference and call a webservice on the server to write the XML. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Doing a binary search in AS3?
Ah - I see - very good, thanks! But you also need to employ some logic at looking at the characters in the string - first the first letter, then once you get down to a list where they all have the same first letter, then take the second, and so forth until you only have one item left - sounds complicated. Reason this whole thing got started with me was Grant Skinner's presentation on AS3 optimization http://www.gskinner.com/talks/quickNL/ See slides 68 69. Binary way faster than linear searching - but no examples on implementing it. I can see how to write this now - but wonder if it would be worth it if using Dictionary would be faster - anyone know? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: Thursday, May 06, 2010 11:06 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? the most important thing being as Hendrik said that it is sorted, which in your example it is not. Say you have: [apple, banana, cherry, kiwi, orange, peach pear, pineapple, ] and you are looking for banana: middle element is orange (or kiwi) take apple, banana, cherry, kiwi, middle element is cherry take apple, banana middle element is banana yeah a hit My description is a bit shabby but you get the idea. Whether it beats a dictionary ... I don't think so, I've only done this when searching through huge sorted files with random file access, not with arrays in flash. regards Hans On Thu, May 6, 2010 at 4:44 PM, Henrik Andersson he...@henke37.cjb.netwrote: Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ 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] Writing to text file
Merrill, Jason wrote: in the FP10 see the FileReference.save() method That's a bit misleading. You might want to also tell him what else he needs on the server side to use that. You can't just use FileReference to save an XML file on anyone's computer. FileReference won't let you write files locally from the Flash player - security restrictions. Use FileReference to save a XML file on a server using server-side scripting in addition. Or skip FileReference and call a webservice on the server to write the XML. Now you are the one being misleading. That exact method allows you to save a file on the client. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Writing to text file
Ah - new in Flash player 10! I didn't know that. Ok -my mistake. Was never possible before - good to know. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of ekameleon Sent: Thursday, May 06, 2010 8:14 AM To: Flash Coders List Subject: Re: [Flashcoders] Writing to text file Hello :) in the FP10 see the FileReference.save() method http://blog.everythingflex.com/2008/10/01/filereferencesave-in-flash-player-10/ EKA+ :) 2010/5/6 Lehr, Theodore ted_l...@federal.dell.com Is it possible to use flash to write to a text file (maybe an xml file)? ___ 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] Doing a binary search in AS3?
Hi Jason, the complexity probably isnt that hard. You have s, you look at wordlist[wordlist.length/2], you find a g, so clearly you have to repeat that for the upper half of the list etc. Dictionary is not going to work here at least not on the whole words, you would have to store partial lookups eg dictionary[a] - all words starting with a here, etc. Maybe even nested dictionaries. regards, JC On Thu, May 6, 2010 at 5:19 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Ah - I see - very good, thanks! But you also need to employ some logic at looking at the characters in the string - first the first letter, then once you get down to a list where they all have the same first letter, then take the second, and so forth until you only have one item left - sounds complicated. Reason this whole thing got started with me was Grant Skinner's presentation on AS3 optimization http://www.gskinner.com/talks/quickNL/ See slides 68 69. Binary way faster than linear searching - but no examples on implementing it. I can see how to write this now - but wonder if it would be worth it if using Dictionary would be faster - anyone know? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: Thursday, May 06, 2010 11:06 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? the most important thing being as Hendrik said that it is sorted, which in your example it is not. Say you have: [apple, banana, cherry, kiwi, orange, peach pear, pineapple, ] and you are looking for banana: middle element is orange (or kiwi) take apple, banana, cherry, kiwi, middle element is cherry take apple, banana middle element is banana yeah a hit My description is a bit shabby but you get the idea. Whether it beats a dictionary ... I don't think so, I've only done this when searching through huge sorted files with random file access, not with arrays in flash. regards Hans On Thu, May 6, 2010 at 4:44 PM, Henrik Andersson he...@henke37.cjb.netwrote: Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ 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] Doing a binary search in AS3?
Thanks - no, I only mentioned Dictionary to see if anyone knew if looking something up in a Dictionary object was faster or slower than a binary search. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: Thursday, May 06, 2010 12:49 PM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? Hi Jason, the complexity probably isnt that hard. You have s, you look at wordlist[wordlist.length/2], you find a g, so clearly you have to repeat that for the upper half of the list etc. Dictionary is not going to work here at least not on the whole words, you would have to store partial lookups eg dictionary[a] - all words starting with a here, etc. Maybe even nested dictionaries. regards, JC On Thu, May 6, 2010 at 5:19 PM, Merrill, Jason jason.merr...@bankofamerica.com wrote: Ah - I see - very good, thanks! But you also need to employ some logic at looking at the characters in the string - first the first letter, then once you get down to a list where they all have the same first letter, then take the second, and so forth until you only have one item left - sounds complicated. Reason this whole thing got started with me was Grant Skinner's presentation on AS3 optimization http://www.gskinner.com/talks/quickNL/ See slides 68 69. Binary way faster than linear searching - but no examples on implementing it. I can see how to write this now - but wonder if it would be worth it if using Dictionary would be faster - anyone know? Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: Thursday, May 06, 2010 11:06 AM To: Flash Coders List Subject: Re: [Flashcoders] Doing a binary search in AS3? the most important thing being as Hendrik said that it is sorted, which in your example it is not. Say you have: [apple, banana, cherry, kiwi, orange, peach pear, pineapple, ] and you are looking for banana: middle element is orange (or kiwi) take apple, banana, cherry, kiwi, middle element is cherry take apple, banana middle element is banana yeah a hit My description is a bit shabby but you get the idea. Whether it beats a dictionary ... I don't think so, I've only done this when searching through huge sorted files with random file access, not with arrays in flash. regards Hans On Thu, May 6, 2010 at 4:44 PM, Henrik Andersson he...@henke37.cjb.netwrote: Merrill, Jason wrote: I understand what a binary search algorithm is, but am wondering how that could be implemented on an array in Actionscript (if at all) without using methods that would defeating the purpose of a binary search (speed). Anyone have experience in this area? So for example, if you have a list like this: [apple, orange, banana, pear, cherry, pineapple, kiwi, peach] Then to do a binary search for say, pineapple, as I understand binary searching, you would first split the list in the middle (between pear and cherry) and determine if pineapple was in that list - if not, search the other half and so on until you find pineapple. That is wrong, you know that it will be in a certain half due to the list being sorted. There is no need to scan the half for the object, by the list already being sorted, you know that if the object exists, it's in that half. Just compare the middle element, if it is bigger, use the left half, else use the right half. ___ 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] Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″
Warning: Typical TechCrunch hyberbole and schadenfreude ahead. Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Read more: http://techcrunch.com/2010/05/05/scribd-html5/?qfds#ixzz0nBF5BxSv ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scribd CTO: “We Are Scrapping Fl ash And Betting The Company On HTML5″
Right tool for the job? IMO Flash has never been that great at displaying documents. On Thu, May 6, 2010 at 12:45 PM, Matt S. mattsp...@gmail.com wrote: Warning: Typical TechCrunch hyberbole and schadenfreude ahead. Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Read more: http://techcrunch.com/2010/05/05/scribd-html5/?qfds#ixzz0nBF5BxSv ___ 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] Scribd CTO: “We Are Scrapping Fl ash And Betting The Company On HTML5″
I wasn't much of a fan of the scribd docs. Not easy to search out your keywords. Different tool for different jobs. With a different view, this could be competing directly with apple since you can get some of the same content w/o paying for it through the app store? Who knows... On Thu, May 6, 2010 at 1:51 PM, Steve Mathews happy...@gmail.com wrote: Right tool for the job? IMO Flash has never been that great at displaying documents. On Thu, May 6, 2010 at 12:45 PM, Matt S. mattsp...@gmail.com wrote: Warning: Typical TechCrunch hyberbole and schadenfreude ahead. Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Read more: http://techcrunch.com/2010/05/05/scribd-html5/?qfds#ixzz0nBF5BxSv ___ 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: [Flash coders] Scribd CTO: “We Are Sc rapping Flash And Be tting The Company On HTML5″
saw this video on the following comments. nice dry delivery, very funny: http://www.youtube.com/watch?v=rfmbZkqORX4 From: mattsp...@gmail.com Date: Thu, 6 May 2010 15:45:07 -0400 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Warning: Typical TechCrunch hyberbole and schadenfreude ahead. Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Read more: http://techcrunch.com/2010/05/05/scribd-html5/?qfds#ixzz0nBF5BxSv ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _ http://clk.atdmt.com/UKM/go/195013117/direct/01/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scribd CTO: “We Are Scrapping Fl ash And Betting The Company On HTML5″
On Thu, May 6, 2010 at 9:51 PM, Steve Mathews happy...@gmail.com wrote: Right tool for the job? IMO Flash has never been that great at displaying documents. I've been using Flash to display document for just over a year now, I must admit, I didn't (and still don't) think it is inappropriate. I'm currently working on an AIR App and I must say, development so far has been really enjoyable. I use a [customized] version of swftool's pdf2swf to convert documents and the iText Library to optimize PDF documents for online rendering. So far so good. File sizes are relatively small and the experience is very fluid and comfortable. There are plenty of features you can add to a flash document viewer to improve the document viewing experience. I will agree with the statement that Flash was probably not envisioned to display documents when it was first created, but can I ask you to corroborate your statement above with specific issues you've encountered. I'm more than happy to stand corrected. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scribd CTO: “We Are Scrapping Fl ash And Betting The Company On HTML5″
On Thu, May 6, 2010 at 8:45 PM, Matt S. mattsp...@gmail.com wrote: Warning: Typical TechCrunch hyberbole and schadenfreude ahead. Scribd CTO: “We Are Scrapping Flash And Betting The Company On HTML5″ Read more: http://techcrunch.com/2010/05/05/scribd-html5/?qfds#ixzz0nBF5BxSv I agree with your first statement. Adobe’s much-beleaguered Flash is about to take another hit and online documents are finally going to join the Web on a more equal footing. ... Today, most documents (PDFs, Word docs, Powerpoint slides) can mostly be viewed only as boxed off curiosities in a Flash player, not as full Web pages. They've clearly not seen the issuu Flash document viewer / haven't heard of the full screen feature (not perfect, but their statement is inaccurate), boxed off curiosities can be a very useful thing if the document is part of content ( a supporting piece etc) and not the main spectacle. I mean, it will also be a boxed off curiosity in HTML5 if users simply want to embed it within their blog. Not only will these documents look great on the iPad’s no-Flash browser (see screenshots), but it will bring the richness of fonts and graphics from documents to native Web pages. I really don't understand the relevance of the first part of this sentence, looks like a paid advert to me. The second part is the only [partially] valid point in the entire article. No one is perfect, there are always trade-offs to be made when choosing a platform. Documents will simply become very long Web pages. A new bookmark feature will help you keep your place in especially long documents. I am currently developing a similar feature in Flash. I store the character index of a selected location and enable the user to make a comment on it. Users can easily jump between these points. This isn't very hard to do. Scribd’s documents will be especially iPad friendly. Instead of downloading a book from Apple’s iBooks store or Amazon’s Kindle app, you can see if an electronic version is on Scribd and read it in your browser. Irrelevant. These are not valid reasons for favoring HTML5 over Flash. Pinch and zoom to make the text bigger. No download necessary. I don't see the relevance of the first part. For the second part, in Flash, there are two ways you can transfer the document, one is to store it in the browser cache (downloading is clearly happening) or you can stream the documents [in which case they're right]. If the documents are going to be long Web pages, then surely, certain aspects of the documents are going to end up in the cache, in that case, No Download necessary is misleading. I know the point they're trying to make, but, technically, the statement is inaccurate. Scribd’s currently uses a Flash player much like YouTube’s to allow people to upload and view documents on the Web. But with HTML5 standards now making their way through not browsers, there is little reason to do that. “Right now the document is in a box,” says Friedman, “a Youtube-type of experience. There is a bunch of content and a bunch of stuff around it. In the new experience we are taking the content out of the box.” Trying to compare Scribd document viewer to YouTube video player is beyond me. Enough said. In the new experience, you're taking content out of one box and putting it in another. Friedman has ben [sic] working secretly on this project for the last six months. You can tell he’s excited about it. He believes the Web is finally ready to ditch Flash for documents. Unlike video players, the parts of the HTML5 standard that impact documents have to do with support for fonts, vector graphics, and rotating text. The blatant spelling error in the first sentence demonstrates quite clearly that this article was not reviewed properly. Besides being a paid advert for a completely useless device, this article offers no solid technical reason to ditch Flash in document delivery systems. Seriously, how many business documents / books / articles in general have you seen that have rotating text in them? I have had to deal with such creatures (once in an entire year), and it is possible to do so in Flash, however, this isn't a compelling reason to abruptly switch platforms. HTML5 documents will still be embeddable in other sites using an iFrame. So if they're embeddable as Flash, they're a boxed off curiosity, but if they're embeddable as an iFrame, they're not. Need I say more? I am looking forward to HTML5. I am playing around with it and I must admit, I love it. I strongly believe that switching platforms should be a decision I need to make for sound technical reasons or to cater for user demand. I certainly do not believe that we should ditch Flash just because certain companies do not like it. That doesn't make any sense. As long as the plugin is in widespread use, it should be supported. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com
[Flashcoders]
static public function hex_to_ascii(sText:String):String { var thisHexChar:String; var retString:String = ; for (var i:int =0; i sText.length/2; i++) { thisHexChar= sText.charAt(i*2).toString() + sText.charAt((i*2)+1).toString(); thisHexChar = 0x + thisHexChar; retString = retString + String.fromCharCode(int(thisHexChar)); } return retString; } I've this function to convert HEX to ASCII, but when i send a packet with Socket.writeUTFBytes this packet go wrong with wrongvalues Example: I send: TCP_Sock.writeUTFBytes( hex_to_ascii( 3c00c1c8df4ad40761646d696e2e24636d6400010015001077686174736d797572690001 ) ) And i see with wireshark the hex value sended was: 3c00c381c388c39f4ac3bfc3bfc3bfc3bfc3940761646d696e2e24636d6400010015001077686174736d797572690001 I dont know how to fix this... can some one helpme pls? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] One Video, multiple Audio tracks?
Hi Matt, You could probably put the 8 other languages into mp3 files, which you can play back using the Sound class. Sound.play() has an optional startTime argument, so you can start playback at any position in the mp3. Suppose the user is playing back the FLV in English, then switches to French. In your code, you would mute the FLV's English audio soundtrack, get the FLV's current playback position (which I assume is possible, though I've never tried!), then call play on a Sound with the French sound track, with startTime set to the FLV's current position. -Gerry On 2010-05-06 , at 21:30 , Matt S. wrote: Is there a reliable way to have one video track, but then swap in audio tracks on the fly and have them sync properly? The client wants a 26 minute video which would be in English, but then also have 8 other language versions that would be dubbed, eg the audio would play over the video. We're trying to figure out if this can be done with a single video and multiple audio, or if it will need to be separate flv's. The reason for not just using different flv's is because the whole thing needs to fit on a CD-ROM so we're dealing with pretty significant size constraints if we want to fit it on one disc. And yes, before you point out that DVD's are exponentially larger than CD's, I know, but the discs will be sent to countries with much less reliability in terms of what kinds of drives they'll have and in all likelihood much higher percentages of users who are still running pc's with CD drives only, no DVD. I pushed for DVD, but lost. Anyhoo, any suggestions much appreciated. thanks, Matt ___ 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]
I found the problem When I use writeUTFBytes something transform my string and send the data wrong... if I use writeUTF same thing... I tryied writeMultiByte but the string goes to 2 bytes... but i dont know what charset use I really need this, can some one help me? -- Rafael Lúcio http://www.hangarnet.com.br ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders]
What is wrong with parseInt(str,16)? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] One Video, multiple Audio tracks?
https://bugs.adobe.com/jira/browse/FP-3551 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders