Re: [Flashcoders] xml whitespace problem
I had this exact problem just last week. I couldn't figure out a solution, so I simply removed all carriage returns and tabs from the raw XML data. Here's the function that I wrote to clean things up. Simply add on onData event handler to your XML loading and then call this function with the raw XML data string. I didn't try the condenseWhite option that Duncan suggests, but if that works, I'll kick myself. Either way, this solution works well for me. function cleanXML(xmlString):String{ var cleanString:String = xmlString; // remove any processing instructions in the XML data while (cleanString.indexOf(?) != -1){ var startIndex = cleanString.indexOf(?); var endIndex = cleanString.indexOf(?) + 2; var dirtyString:String = cleanString.slice(startIndex, endIndex); cleanString = cleanString.split(dirtyString).join(); } // remove any extranieous \t\n\r characters in the XML data cleanString = cleanString.split(\r).join(); cleanString = cleanString.split(\n).join(); cleanString = cleanString.split(\t).join(); return cleanString; } Note that I'm also removing all processing instructions from the XML as well because Flash can't handle them (my clients are using Altova StyleVision to edit the content and that puts an extra processing instruction block at the top of the XML file). Hope that helps, Josh On Jan 24, 2006, at 3:34 PM, david kraftsow wrote: Hi. Whats the easiest way to strip out that annoying whitespace from your xml nodes? I have a lovely human-readable xml file with tons of carriage returns and tabs. When I load it into a flash XML object the leaf/ content nodes all have tabs and carriage returns in them. Setting the ignoreWhite property does nothing. [?] Example: root_1 attr_1=blahblah node_1 ![CDATA[ Leaf content 1 blah blah blah. ]] /node_1 /root_1 When I parse out that leaf content I get a string like \n \nLeaf content Very annoying. I don't have to write a traversal method to strip it all out do I? Surely there is a better way! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] input text scrolls when pressing right arrow key
Are you specifying a width for this text field? I can't duplicate this on my machine (Mac G5), but I'm guessing it's because you're not setting a width and you also have autosize set to left. Changing either of those parameters should do the trick. Josh On Jan 6, 2006, at 5:19 AM, fla coder wrote: hi please try the following: create a TextField with properties similar to: txf.type = input; txf.autoSize = left; txf.multiline = false; txf.wordWrap = false; txf.text = test; run the movie and click inside the field. press the right cursor key until you reach the last character in the field. (the last 't' of 'text'). now, if you press the right cursor key again, the word scrolls to the left. my question is, is there any way to stop this behaviour? open to nasty, but processor friendly tricks if that is the only way... many thanks fla ___ 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] getTextExtent and embedded images
I'm dynamically populating a textField with HTML and would like to get the entire height of the textField, including embedded images. Is there a method for determining the height of a textField that includes an embedded image? Both the textEntent and _height values do not take the image into account, even if I specify a width and height for the image. I did notice that the help docs for getTextExtent mentions that text is treated as plain text, not HTML text, so that would explain why textExtent doesn't work. Is there another way? Thanks, Josh ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] getTextExtent and embedded images [RESOLVED]
Ok, I figure out that if I have wordwrap AND autosize set to true, then the _height property of the textField does take into account any width and height attributes you specify for the image. This is only a minor inconvenience, and much better than setting up an interval to check for when the image has loaded and then continuing on with my code. Josh On Jan 5, 2006, at 11:26 AM, Josh Gormley wrote: I'm dynamically populating a textField with HTML and would like to get the entire height of the textField, including embedded images. Is there a method for determining the height of a textField that includes an embedded image? Both the textEntent and _height values do not take the image into account, even if I specify a width and height for the image. I did notice that the help docs for getTextExtent mentions that text is treated as plain text, not HTML text, so that would explain why textExtent doesn't work. Is there another way? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash 8 and SCORM conformance test suite
Hi Brooks, That's some good info, I didn't realize that file even existed. I also figured out an alternate solution. Instead of running the test suite from my local drive, I simply uploaded it to a web server and ran it from there. The only modification I had to make was to remove a line of code in the test suite that forced a local path (there is a function that adds file:/// to the beginning of the course location string, I simply bipassed that function). The only other caveat to this solution is that you have to have your course on the same domain as the test suite. That's not a big issue, but might not seem apparent to those who haven't yet dealt with SCORM's cross domain issues. Thanks for the responses, Josh ps. I also posted this info to ADL's public message boards (http:// www.adlnet.org/forums/). That's a decent resource for anybody who needs help with SCORM issues. On Nov 18, 2005, at 7:00 PM, Brooks Andrus wrote: Do a search for FlashAuthor.cfg in the Help docs or on the web -- this allows you to set up trusted directories on your pc so you can test on the local file system without the sandbox tightening its jaws on you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flash 8 and SCORM conformance test suite
This is a question for anybody who builds SCORM compliant courses using Flash: Now that Flash 8 restricts the use of calls to Javascript while the file is being run locally, how can you test your course using the SCORM conformance test suite (version 1.2.7)? - In order to use the test suite, you have to run your course from the local hard drive. - In order for a Flash course to communicate with the LMS, you need to make Javascript calls. - You can't make Javascript calls from Flash when running locally [using the Flash 8 plugin]. Am I missing something simple, or is this a pretty big problem? thanks, Josh ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] on2 VP6 encoding question
Does anybody know how the Flash 8 video encoder determines when to insert keyframes if you set the value to automatic? All of the other encoding software I've used requires that you specify a keyframe setting, so this automatic setting is new to me. Does the encoder somehow intelligently calculate the best locations for keyframes? If so, that would be really cool, but I can't prove this one way or the other. thanks, Josh ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML processing instructions
thanks for the quick response, but unfortunately it didn't work. if I add a trace(this) right after the this.onLoad(true) line, I only get the XML structure up to the point of the processing instructions. Here is the code I'm using: myXML = new XML(); myXML.ignoreWhite = true; myXML.load(data/data.xml); myXML.onData = function(src) { if(src.substr(0, 1) != ?) { this.loaded = true; this.parseXML(src); this.onLoad(true); trace(this); } } My XML looks like this: ?xml version=1.0 encoding=iso-8859-1? !DOCTYPE data SYSTEM data-schema.dtd ?altova_sps blah.sps? data gameSettings SNIPPED And the trace from the code above returns this: ?xml version=1.0 encoding=iso-8859-1?!DOCTYPE data SYSTEM data-schema.dtd any thoughts? Josh On Nov 4, 2005, at 3:44 PM, JesterXL wrote: Use onData instead of onLoad. my_xml = new XML(); my_xml.onData = function(str) { if(str.substr(0, 1) != ?) { this.loaded = true; this.parseXML(str); this.onLoad(true); } }; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML processing instructions
I guess I could use the string that is passed to the onData function and remove any processing tags before the string is parsed as XML Is that what you were suggesting? Josh On Nov 4, 2005, at 3:44 PM, JesterXL wrote: Use onData instead of onLoad. my_xml = new XML(); my_xml.onData = function(str) { if(str.substr(0, 1) != ?) { this.loaded = true; this.parseXML(str); this.onLoad(true); } }; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Passing param to cuePoint object
Hi Steve, I'm actually just starting out my research into how to use Flash 8's embedded cuepoints to handle closed captioning. Needless to say, documentation is rather weak right now. Below is my working code for displaying the captions that I embedded in the FLV file using the Flash 8 video encoder tool. It's not what you were looking for in terms of merging the captions from an XML file during runtime, but it does show how to get those captions while the video is playing. The biggest confusion for me was linking the netstream with the video object. I did not realize that there is a new video object in Flash 8 and that's what you need to have on stage to display the video. Here is what the help docs say about creating a new video object: To display the video stream, first place a Video object on the Stage. Then use Video.attachVideo() to attach the video stream to the Video object. If the Library panel isn't visible, select Window Library to display it. Add an embedded Video object to the library by clicking the Options menu on the right side of the Library panel title bar and selecting New Video. Drag the Video object to the Stage and use the Property inspector to give it a unique instance name, such as my_video. (Do not name it Video.) /// BEGIN CODE import mx.utils.Delegate import mx.video.* var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); player.attachVideo(ns); // player is the video object (not an FLVPlayback) that I have on stage ns.onCuePoint = Delegate.create(this, handleCuepoint); ns.play(test.flv); function handleCuepoint(infoObject:Object){ captionText.text = infoObject.parameters.caption; } pauseButton.onPress = function(){ ns.pause(); } /// END CODE Hope this helps, and please post any code you get to combine XML with FLV's at runtime, I am also looking in that direction. Josh On Oct 21, 2005, at 9:32 AM, Stephen Hueners wrote: Given the potential utility of cupoints in general the supplied documentation seems ummlite. To import cuepoint information from an XML file structured as: ... SNIP ... I'd very much appreciate any direction in these documentary holes by anyone able to address. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Not getting my own posts
GMail users do not (by default, at least) receive emails from themselves. You may be able to configure this, but I'm not sure (I don't use GMail). Josh On Oct 21, 2005, at 5:01 PM, Eric E. Dolecki wrote: Even though the list is set to send me my own posts, I am not getting them... e.dolecki ___ 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] closed caption options
Does anybody have an opinion to offer on the various closed caption options for Flash video? I'm going to be building a project that dynamically loads in a number of external FLVs (not streamed) and I need to be able to show closed caption text with the video. Here's what I've found so far, any feedback from people who have used them would be much appreciated: captionate (http://buraks.com/captionate/) - embeds the data right in the FLV - very flexible in terms of where I display the captions on screen Hi-caption (http://www.hisoftware.com/hmcc/index.html) - uses standard XML format to store the captions externally - includes component for displaying captions MAGpie (http://ncam.wgbh.org/webaccess/magpie/) - exports captions to XML - i would have to roll my own XML parsing and display mechanisms Does anybody know how MM does it on their site? I'm guessing they do it with the streaming server, but do those techniques transfer over to linked FLVs? thanks, Josh Gormley ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders