Re: [Flashcoders] elearing content using adobe air for ipad
Hi, You can load swfs into the app BUT the swfs can not contain any action script in them. This includes giving class names to items in your library or even simple stop() commands. We use swfs as external libraries in our as3 built apps but our approach has been to put items on the stage and name those instances (which you can do with imported swfs). Then use getChildByName to extract the instances we need. You definitely need to use Apple's philosophy and Think Different but it does work. cheers, Rob On 2012-06-13, at 10:04 AM, Hans Wichman wrote: . *However* as far as I know you cannot load an swf with it. This might require a different architectural setup than you had in mind. On 13-6-2012 15:35, Sumeet Kumar wrote: Thanks a lot for such a quick reply. I haven't googled it much but you guessed it right, I am bit worried about some features like 1.Will urlloader/loader(inbuilt as3 class) classes work fine. I wish to load swf built in as3 in my main file. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] elearing content using adobe air for ipad
Hi Paul, What we do is have a swf that has a library of animations or images, all contained in movie clips. These movie clips are then dropped onto the stage and each instance given a name. Once the swf is loaded you can then reference the instance by using getChildByName(instanceName). Once you have reference to that animation you can throw it into any display object and it will show up in your app. To get around with the stop limitation you can use some code to dynamically add code to the animations after you have gotten access to them. We do something like this to dynamically add stop code just before each frame label of a movie clip. Then you for each (var fLabel:FrameLabel in _skin.currentLabels) { _frameLabels.push(fLabel.name); var labelFrame:int = fLabel.frame if (labelFrame 1) { //for addFrameScript the frame numbers are 0 based //to add a stop frame on the one previous to the current frame label: -2 _skin.addFrameScript(labelFrame - 2, function ():void{_skin.stop()}); } } //add a stop on the last frame of the skin _skin.addFrameScript(_skin.totalFrames - 2, function ():void{_skin.stop()}); hth, Rob On 2012-06-14, at 9:06 AM, Paul Steven wrote: Rob Can you elaborate on this further please? I am working on an iPad only app using Flash CS5.5 and the client has asked if the app could load in animated graphs. I initially thought this would be easy loading in a swf but then discovered that not even a stop action was possible. It sounds like you may have an alternative solution so would be interested to know more. Thanks Paul -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rob Romanek Sent: 14 June 2012 13:58 To: Flash Coders List Subject: Re: [Flashcoders] elearing content using adobe air for ipad Hi, You can load swfs into the app BUT the swfs can not contain any action script in them. This includes giving class names to items in your library or even simple stop() commands. We use swfs as external libraries in our as3 built apps but our approach has been to put items on the stage and name those instances (which you can do with imported swfs). Then use getChildByName to extract the instances we need. You definitely need to use Apple's philosophy and Think Different but it does work. cheers, Rob On 2012-06-13, at 10:04 AM, Hans Wichman wrote: . *However* as far as I know you cannot load an swf with it. This might require a different architectural setup than you had in mind. On 13-6-2012 15:35, Sumeet Kumar wrote: Thanks a lot for such a quick reply. I haven't googled it much but you guessed it right, I am bit worried about some features like 1. Will urlloader/loader(inbuilt as3 class) classes work fine. I wish to load swf built in as3 in my main 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] AIR and external mp3's
Hi John, Yes I have developed apps that use external mp3 files, that was a last year so I'm trying to remember if we had any gotchyas. It should work. Are you sure you are bundling the mp3 files properly with your app so they exist on the iPad? If I come up with any ideas I'll let you know. cheers, Rob On 2012-03-15, at 2:25 PM, John R. Sweeney Jr. wrote: So no one has dabbled in iPad apps? That's a bit surprising or is that saying don't? :( John R. Sweeney Jr. Senior Interactive Multimedia Developer OnDemand Interactive Inc Hoffman Estates, IL 60169 On Mar 14, 2012, at 1:57 PM, John R. Sweeney Jr. wrote: Has anyone built a app in AIR for iPad? I'm experimenting now, for a project coming up and have found that when I access an external mp3 and try to load and play, that it doesn't play. Works on my desktop, but not on the iPad. I have internal audio that works just fine, but can't hear the external, so I'm assuming that is not loading? I'm sure there are other gotcha's going to the iPad, so any ideas of a good resource or book on the specific subject of AIR for iPad that someone would recommend. This one is going to be fun… :) John Senior Interactive Multimedia Developer OnDemand Interactive Inc Hoffman Estates, IL 60169 ___ 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] AS3 MOUSE_OVER/OUT bubbling
Hey Andrew, Try setting mouseEnabled to false for your cursor sprite. hth, Rob On 5-Jul-09, at 8:40 AM, Andrew Sinning wrote: 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. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML find and delete nodes
This might get you pointed in the right direction. You can get an XMLList of all the empty nodes by this kind of statement xml.modules.module.(children().length() == 0); but if you then try a simple delete on that delete xml.modules.module.(children().length() == 0); you get: Delete operator is not supported with operand of type XMLList. I'm not sure right now why that wouldn't work. But you could simply loop through the XMLList generated and do a delete on each node var emptyModule:XMLList = xml.modules.module.(children().length() == 0); var index:int = emptyModule.length() - 1; for(var i = index; i - 1; i--){ delete emptyModule[i]; } trace(xml); hth, Rob PS so as far as the delete operator I'm not sure why delete(xml.modules.module) works while something like delete(xm.modules.module.(@title == apple)) gives an error like above. I would think that both those querries result in an XMLList, in the first case the delete occurs but not in the second... maybe some lunch will help my brain work better. On 9-Jun-09, at 11:02 AM, Merrill, Jason wrote: Posted this on Flash_tiger without any luck. I know about using delete in E4X XML to delete unwanted XML nodes, but how would you hunt down through and delete any nodes (of a specific type, say module nodes in the example below) that don't have any children? For example, if myXML happens to look like: xml modules module title=apple/ module title=orange node/ module module title=banana node/ module module title=plum/ module title=pear/ module title=pineapple node/ module /modules /xml then with that structure, I would want my code to remove the module nodes that have the title attribute values of apple, plum, and pear since those have no child nodes. I know I could figure it out through enough trial and error, but I've spent enough time on it already. Thought someone here could give a quick answer. Thanks! 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
Re: [Flashcoders] XML find and delete nodes
Since Jason wanted to get rid of all the nodes that were empty he would want to filter against !=0 and then use setChildren to refresh his original xml. Using setChildren is a nifty trick, much nicer than that delete loop I put out there. Rob On 9-Jun-09, at 12:24 PM, Steven Sacks wrote: Filter the XML using E4X and then make a new XML from that filtered result. var xml:XML = xml modules module title=apple/ module title=orange node/ /module module title=banana node/ /module module title=plum/ module title=pear/ module title=pineapple node/ /module /modules /xml; // var list:XMLList = xml..module.(children().length() == 0); var newXML:XML = xml/; xml.setChildren(list); trace(xml); ___ 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] Creating Dynamic addEventListeners with AS3
You can try something along the lines of var stateButton = getChildByName(State_ + rs[i]); stateButton.addEventListener(MouseEvent.CLICK, StateButtonClicked); hth, Rob On 5-Apr-09, at 8:33 PM, Graham Pearson wrote: What I am trying to do is when I retrieve the recordset back from the coldfusion component is to loop through the results like function GetClientsWithinCategory_Result(rs.Object) { for (var i:int = 0; i rs.length; i++) { State_rs[i].addEventListener(MouseEvent.CLICK, StateButtonClicked); // The Value of rs[i] will return the 2 letter abriviation of the State eg: IN, WI, etc } } How do I go about combining State_ + the result from rs[i] so that when a user clicks on Indiana it will run the actionscript within the State Button Clicked Function ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] change the origin of rotation for a movieclip?
Hey Anthony have you checked out the MatrixTransformer class its got a handy function, rotateAroundInternalPoint(), which will serve you well. Rob On 12-Jan-09, at 3:24 PM, Anthony Pace wrote: -Original Message- From: Anthony Pace [mailto:anthony.p...@utoronto.ca] Sent: Saturday, January 10, 2009 6:12 PM To: Flash Coders List Subject: [Flashcoders] change the origin of rotation for a movieclip? How do you change the origin of rotation dynamically? can it be done? or will it always be 0,0 I was hoping that with the new features of as3 that this I would be able to indicate where I wanted the origin; yet, I am starting to think that I was hoping for too much. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] multiple fonts in TextField?
Hi Michael, If your second font is not embedded in any text field but only available via linkage then while it is embedded in your file it is not available for usage. To make it available you need to use the registerFont function with your linked font. After that it should show up in any text field with embedFonts set to true. hth, Rob On 12-Jan-09, at 3:45 PM, Mendelsohn, Michael wrote: Hi list... I am trying to set a TextField (embedFonts = true) to some htmlText. It has a defaultTextFormat of a particular font embedded with linkage name XYZ. I have two fonts in my project, the other one being linkage XYZBold. I want the htmlText to be something like: font face='XYZBold'XYZ Bold stuff/fontbrXYZ regular stuff; XYZ regular stuff shows up, but XYZ Bold stuff doesn't show up. Can't you embed two fonts in one TextField? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] text line overflow
Hi Latcho, I see you've gotten a couple response but I'll throw another one in to the mix. The main functions that will interest you are: 1) getCharIndexAtPoint which locates the char at the edge of the textfield 2) replaceSelectedText which is used to substitute in ... This is some code ripped out of a class I use that extends TextField and does a bunch of things for me, one of which is the truncation of text. It is not complete but should give you an idea for approaching this problem. private var _htmlText:String = ; //holds the complete text for the field even when truncation occurs private var _tempText:TextField = new TextField();; //another textField which is used to truncate the text and then place it into this actual field private var _gutterCompensation:Number = -5; // -5 compensates for the gutter on either side of the text private function checkDimensions(){ _htmlText = super.htmlText; if(super.textWidth width - _gutterCompensation){ //use the temporary text holder to do the text shortening and replacing _tempText.htmlText = _htmlText; _tempText.defaultTextFormat = super.defaultTextFormat; //this ensures that the ... are placed using the correct formatting //find the character located at the edge of the text then count back 2 more characters and replace everything from there to the end with ... _tempText.setSelection(super.getCharIndexAtPoint(width- _gutterCompensation, 2)-2, super.text.length); _tempText.replaceSelectedText(...); super.htmlText = _tempText.htmlText; } Again is this an email/modified version so it is not complete just to give you ideas. (I don't remember if I really needed to use super.htmlText or could have gotten by with just this.htmlText) Basically what I do is when the text field looses focus after editting I run the checkDimensions function which does my truncation but also stores the complete text. When the user brings the textfield back in to focus I replace the truncated text with the complete text I have stored. hth, Rob On 17-Nov-08, at 4:26 AM, Latcho wrote: How to break a line of text on the optimal charachter and adding ... if it doesn't fit a single lined textfield | I would like to break | this line of text. | I would like to br... | Any suggestions (AS3) Latcho ___ 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] open word document from flash
From within a browser or are you creating a stand-alone app that needs to open the files? If a stand alone then you could use a wrapper. I've done this with AS3 Flash running as an active-x component inside of Director 10. Flash communicates to Director, Director uses an xtra like Buddy-API to open the files. Rob On 23-Oct-08, at 3:24 PM, Bassam M wrote: Hi guy Is there anyway that I can open word-excel files from flash Thanks Basam ___ 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] ComBox Box - Font Issues
I'm pretty sure the text field trick should work because it forces the font to be registered. Just embedding fonts in your library won't be enough if they are accessed via code only. To avoid the text field trick you will need to use Font.registerFont() to make them usable in your app. Something along the lines of: var tClass:Class = getDefinitionByName(Gotham Medium) as Class; Font.registerFont(tClass); hth, Rob On 18-Oct-08, at 12:38 PM, Glen Pike wrote: Hi, Try putting a text field off the stage set and embed your chosen font into it - that used to do the trick with AS2. Glen karim beyrouti wrote: Hi list - I am using the flash CS3 components - and have hit a little snag - when testing in the IDE ( or just running the SWF ) all the fonts show up fine - no problem. However the moment the site goes in the browser - the font does not show up in the ComboBox textField, however they show up no in the dropdown menu. I have embedded the font in my library - and well - i have no clue as to why this is not working in the browser. this is the code i am using to format the combobox: code var tf:TextFormat = new TextFormat(); tf.font = Gotham Medium; tf.size = 12; tf.bold = false; cmb_mc.dropdown.setRendererStyle(embedFonts, true); cmb_mc.dropdown.setRendererStyle(textFormat, tf); cmb_mc.textField.setStyle(embedFonts, true); cmb_mc.textField.setStyle(textFormat, tf); /code Kind regards Karim Beyrouti ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] Problems creating a drag and drop
Hey Glen when you say your mouse up is outside the stage do you mean that the mouse up is occurring outside of the dragged object in which case the object catching the up event is the stage object. (Rest of your sentence seems to imply that.) Susan, if you imagine your cursor moving faster than the drag object can keep up then what happens is the mouse up occurs outside of the object but since there is no built in mouseUpOutside event you are going to have to build your own. If you google senocular as3 mouseupoutside you should get some good hits on tutorials explaining how to use the stage object to catch these mouse up events. hth, Rob On 24-Sep-08, at 2:55 PM, Glen Pike wrote: Hi, It could be because your mouse up is outside the stage - I have had problems with that - search for MOUSE_LEAVE or something similar - it maybe on the stage object. Glen Lord, Susan, CTR, DSS wrote: Hi there, I am having problems with my event listener for my drag and drop. Sometimes it detects the mouse up event and sometimes it doesn't and won't let go of the object (stopDrag). Have any of you ever run into this? If so, is there a fix? Basically I have this coding... function stopDragging(event:MouseEvent):void { trace(mouse up) // There is more function code I just didn't want to paste it all in. } Triggered by: for (i= 0; i aButtons.length; i++) { aButtons[i].mouseChildren = false; aButtons[i].addEventListener(MouseEvent.MOUSE_DOWN, startDragging); aButtons[i].addEventListener(MouseEvent.MOUSE_UP, stopDragging); } Any ideas? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] Two problems with BitmapData.draw() w/r/t registration point and transparency
As suggested Matrix will get you there. Here is some sample code: var box1 = new Sprite(); box1.graphics.beginFill(0xff); box1.graphics.drawRect(-10,-10,10,10); box1.graphics.endFill(); box1.graphics.beginFill(0x00ff00); box1.graphics.drawRect(0,0,20,20); box1.graphics.endFill(); addChild(box1); box1.x = 10; box1.y = 10; var bounds = box1.getBounds(box1); var bmd = new BitmapData(bounds.width, bounds.height, true, 0x00); bmd.draw(box1, new Matrix(1,0,0,1, -bounds.x, -bounds.y),null, null,null, true); var bm = new Bitmap(bmd); addChild(bm); bm.x = 100; bm.y = 0; note that what used to be the -10, -10 point in the original sprite has be translated to the 0,0 point in the bitmap so if you wanted to line the two up you need to compensate for this difference in registration point. hth, Rob On 3-Jul-08, at 8:52 AM, Ashim D'Silva wrote: I've found you have to set up the bitmapdata to have 4 channels instead of 3 to get transparency. So for a transparent image... new BitmapData(width, height, true, 0x); That should make it truly transparent. And for the first part, I haven't tried it, but have you looked into using a Matrix? 2008/7/3 jonathan howe [EMAIL PROTECTED]: Hi, gang, I have a long list of MovieClips. For each one, I want to create a bitmap icon that shows the first frame. The problems I'm having: 1. The MovieClips often have content above and before (-y and -x) the registration point, and simply performing BitmapData.draw() I don't seem to get the negative data 2. I'd like transparency on the resultant bitmaps. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Maintain position on rotation
Hi Eric, Try out this code, should do the trick and show that localToGlobal does work Run it once as is, then uncomment the rotation and see the results. hth, Rob var sprite1:Sprite = new Sprite(); sprite1.graphics.beginFill(0x00ff00); sprite1.graphics.drawRect(0,0,100,100); sprite1.graphics.endFill(); var sprite2:Sprite = new Sprite(); sprite2.graphics.beginFill(0xff); sprite2.graphics.drawRect(0,0,10,10); sprite2.graphics.endFill(); sprite1.addChild(sprite2); sprite2.x = 90; sprite2.y = 90; addChild(sprite1); sprite1.x=100; sprite1.y=100; //sprite1.rotation = 45; trace(sprite1.localToGlobal(new Point(sprite2.x, sprite2.y))); On 18-Jun-08, at 1:27 PM, eric e. dolecki wrote: AS3. I have a MC I am rotating, and inside the MC I have a Sprite (affixed to the bottom of the MC). While rotating, I want to place another MC's x,y (each frame) on that rotating MC. However the x,y never updates. I tried localToGlobal, but that doesn't seem to change either during the rotation. Can this be easily done? ___ 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] stack overflow in IE ?
FYI Also crashes under OSX 10.5.2, Safari 3.1, FP 9,0,115,0 On 20-May-08, at 10:13 AM, Andrei Thomaz wrote: dear Jonathan, in my computer, with the same versions of Firefox and FP, also under Vista, it runs fine. What worries me is that it doesn't use recursion, just some nested loops, used when the algorithm ends. thank you, andrei On Tue, May 20, 2008 at 10:28 AM, jonathan howe [EMAIL PROTECTED] wrote: Andrei, It also crashed in Firefox 2.0.0.14 Vista PC with FP 9,0,124,0. -jonathan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] need help.. switch statement parameters
Try changing this line: switch(event.target.selection.name) { to this: switch(e.target.selection.name) { hth, Rob On 17-May-08, at 11:35 AM, rlyn ben wrote: its giving me 1120 error on switch statement parameters.. switch(event.target.selection.name) { what am i missing on the code?... import flash.events.Event; import fl.events.ComponentEvent; import fl.controls.RadioButtonGroup; stop(); var gRB:RadioButtonGroup = RadioButtonGroup.getGroup(genderGroup); gRB.addEventListener(MouseEvent.CLICK, genderHandler); function genderHandler(e:MouseEvent):void { switch(event.target.selection.name) { case maleRB: maleRB.value = 1; break; case femaleRB: femaleRB.value = 0; break; //action } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Problem with For loop
Try the change I've added below and see if it works for you. On 2-May-08, at 10:58 AM, SJM - Flash wrote: This function should loop through 5 times creating 5 different MovieClips, each one with a mouse click event attached, which should trace the value of i either 1, 2, 3, 4 or 5. So the first movieclip should output 1, second should output 2 and so on... for (var i = 0; i itemList.length(); i++) // itemList.length() is equal to 5 { _summaryElement[i] = loadLibrary(itemContainer); // Loads MovieClip from library _summaryElement[i].name = String(i); trace(i); // Outputs correctly 1... 2... 3... 4... 5... var summaryClick = function (ev:Event) { //trace(i); // Outputs incorrectly (Outputs 5 on each MovieClip click) ??? trace(ev.target.name); } addChild(_summaryElement[i]); // Adds MovieClip to stage _summaryElement[i].addEventListener(MouseEvent.CLICK, summaryClick); // Adds an click event to each MovieClip } Thanks SJM ___ 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 with listener for custom class (AS3)
Hi Dane, Here are some thoughts for you to try. First off since you are not actually working with a display object you don't need this class to extend sprite. The easiest way to give the class the ability to send out events is to have it extend EventDispatcher and then you can have it dispatch events as required... here is you sample pared down a bit, just dealing with xml package { import flash.events.*; import flash.net.*; public class fileImports extends EventDispatcher { public var newStyleSheet:StyleSheet = new StyleSheet(); public var newXML:XML = new XML(); public function fileImports(xmlFile:String):void { var xmlToLoad:URLRequest=new URLRequest(xmlFile); var xmlLoader:URLLoader = new URLLoader; xmlLoader.load(xmlToLoad); //event listeners xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded); } public function xmlLoaded(event:Event):void { newXML = XML(event.target.data); dispatchEvent(new Event(Event.COMPLETE)); } } } then in the movie calling the class var tFile = new fileImports(data/xml/presenter1.xml); tFile.addEventListener(Event.COMPLETE, xmlDone); function xmlDone(e:Event){ trace(done); } hth, Rob On Tue, 11 Sep 2007 15:25:05 -0400, Dane Williams [EMAIL PROTECTED] wrote: My problem is I don't know how to listen to the class from the main timeline to find out if the class is finished processing the XML. Right now if I try to use fileForThis.newXML I get a value of null. But if I put a trace on newXML in the class, it shows the content of my XML file. I have gotten this to work on other projects because I haven't tried to use the data immediately - so the data has time to process before it's put into a text field, etc. I appreciate any help I can get on this. Thanks! -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Radial Gradient Programmatic Masks in AS3.0
What have you tried? I don't think you can do this via the timeline you need to do it programatically by setting the mask of a clip to another clip which has it's bitmap caching set to true. hth, Rob On Thu, 13 Sep 2007 14:19:42 -0400, Patrick Lemiuex [EMAIL PROTECTED] wrote: Hi, I was trying to script a spotlight effect in AS3... I didn't have any luck, apparently, it's pretty common to do this and come up with a rectangle. Does anyone have a working example of this? This is probably something I am going to do over and over again so help is really appreciated. Thanks, Patrick ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Radial Gradient Programmatic Masks in AS3.0
This should work for you... http://www.manibus.com/codeSamples/maskTest.fla Rob On Thu, 13 Sep 2007 15:41:46 -0400, Patrick Lemiuex [EMAIL PROTECTED] wrote: Yeah, that didn't work, i am not using the timeline, very rarely do i use the timeline these days. I need a working example to understand the exact process Thanks, Patrick On Sep 13, 2007, at 12:35 PM, Rob Romanek wrote: What have you tried? I don't think you can do this via the timeline you need to do it programatically by setting the mask of a clip to another clip which has it's bitmap caching set to true. hth, Rob ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Live Preview communicating with Flash
I'm playing around with components some more in Flash and am trying to figure out a way for the live preview to get the file name of the currently active document in Flash. I was wondering if this might be doable using the ExternalInterface class. While I can get the live preview to tell be that an external interface is available I can't work out what functions I can call to the application hosting that live preview(i'm assuming that is Flash itself) and if there is a call that would return the file name of the current document. Any thoughts? Is there an easier way to do this? thanks, Rob ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] long dash
I reference this page: http://www.w3.org/TR/html4/sgml/entities.html try c=a #8212; b hth, Rob On Thu, 23 Aug 2007 14:07:38 -0400, natalia Vikhtinskaya [EMAIL PROTECTED] wrote: Hi I thought it simple but that does not work.I am trying to show long dash c=a mdash; b txt.html=true; txt.htmlText=c; But that does not work. What am I doing wrong? Thanks in advance ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] AS3 BitmapGradientFill
I'm sure I'm missing something basic here. In Flash 9 I'm trying to create a gradient fill that starts at blue, over the first 3rd of the shape it fades to white, remains solid white over the next 3rd then over the final 3rd it fades from white back to blue. I thought the code below should do it but I get an image that starts off solid white for about the first 3rd then fades to blue. Any suggestions on what I'm doing wrong. Thanks, Rob var _grad:Shape = new Shape(); _grad.graphics.beginGradientFill(linear, [0xff, 0xff, 0xff, 0xff], [1, 1, 1, 1], [0,85,170,255]); _grad.graphics.drawRect(0,0,100,100); _grad.graphics.endFill(); addChild(_grad); ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS3 BitmapGradientFill
Thanks alot, that does the trick. Rob On Wed, 18 Jul 2007 16:45:59 -0400, Rákos Attila [EMAIL PROTECTED] wrote: Set up a matrix which determines the gradient box and pass it to the beginGradientFill(), e.g: var m: Matrix = new Matrix(); m.createGradientBox(100, 100); _grad.graphics.beginGradientFill(linear, [0xff, 0xff, 0xff, 0xff], [1, 1, 1, 1], [0,85,170,255], m); Attila ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS3 package and class access
What is your import statement for the singleton like? import com.foo.view.MySingletonClass; Rob On Tue, 17 Jul 2007 14:10:56 -0400, Matt Muller [EMAIL PROTECTED] wrote: Hi, I have a question about class instantiation. I have a class in this package com.foo.view.playerSkins I am trying to instantiate a singleton in com.foo.view (1 dir up) The compiler is throwing the following error... 1120: Access of undefined property TestInstance. However when its in the same package com.foo.view.playerSkins I can import and instantiate it. Has anyone got any ideas? Cheers, MaTT ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] as3 Loader.content.name error
If you want to call addChild on the content then you can simply do: addChild(event.target.content) and that will throw your content on the stage. I'm not sure why it is not possible to name that new content. I've tried playing around with this myself and can't figure out how once you've loaded the content you can access that content as a class. I've loaded up swfs and can reference classes within the swf no problem and create instances of those classes but if I try to get a class definition for the content all I can get is MovieClip and I can't figure out how to create new instances of the that loaded content without running another loader Not sure if that helps you any or not. Rob On Wed, 06 Jun 2007 22:59:33 -0400, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote: Is there a way a change the name of the Loader content property. I'd like to call addChild() on the content instead of the Loader itself. Like this : loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, loaderInit); var request:URLRequest = new URLRequest(pageSource); loader.load(request); private function loaderInit(event:Event):void{ event.target.removeEventListener(Event.INIT, loaderInit); var page:Page = event.target.content; page.name = test; } That code throws this error but I cant understand why. Error: Error #2078: The name property of a Timeline-placed object cannot be modified. at flash.display::DisplayObject/set name() at com.blitzagency.fabric::Main/::loaderInit() ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] as3 Loader.content.name error
Another workaround that I've been using is to use the loading swf as wrapper for the movieClip I ultimately want to display on the stage. Create the content you want to use as movieClip symbol in your swf, export for actionscript, no need to put it on the stage, and give it a class name. Now you can load the wrapper swf. As soon as you do all the classes in that wrapper will be available throughout your project and you can access them by name. Untested e-mail code: loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, loaderInit); var request:URLRequest = new URLRequest(pageSource); loader.load(request); private function loaderInit(event:Event):void{ var myClass:Class = getDefinitionByName(myClassInMySwf) as Class; var newClip:MovieClip = new myClass(); newClip.name = test; addChild(newClip); } This way you can create a library of swfs that you can load in and use as required. If you make two libraries with the class internally named the same then you can change up your app just by loading in a different library swf. Rob On Thu, 07 Jun 2007 13:39:48 -0400, Patrick Matte|BLITZ [EMAIL PROTECTED] wrote: I want to rename the content because I need to be able to access it later using getChildByName(test); But since its not possible, I think I'll have to make my classes dynamic and do this instead : private function loaderInit(event:Event):void{ event.target.removeEventListener(Event.INIT, loaderInit); this[test] = event.target.content; addChild( this[test] ); } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Flash C3 and Embedding resources
Try this out in your sub-loaded swf var tClass:Class = getDefinitionByName(Box) as Class; addChild(new tClass()); hth, Rob On Fri, 01 Jun 2007 12:15:09 -0400, Smith, Philip [EMAIL PROTECTED] wrote: If a graphical library linkage element you want to add/attach is in the host .swf library (ie 'Box' class), how you would access it from a sub-loaded .swf without throwing an error? subSWF-addChild(new Box()) --undefined. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: Friday, June 01, 2007 12:01 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Flash C3 and Embedding resources [Embed] is Flex only, because FlexBuilder doesn't have a library, like the Flash IDE has. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] AS3 Component talking to authoring environment
Hi All, I've been playing around with building my own components in AS3 and am trying to figure out if there is a way to get the live preview of the component to get info from the authoring environment. For example the file path of the fla into which the component was dropped. Thanks, Rob ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] scope in AS3
On Wed, 28 Mar 2007 18:14:50 -0400, Dennis Asher [EMAIL PROTECTED] wrote: I've managed to avoid OOP till now but AS3 is here and no choice now. What's wrong in the class below? The code in the mouseover/mouseout functions do not reference the textfield correctly. I've tried adding: event.hello.visible = true; and event.target.hello.visible = true; Hi Dennis, Made a small change to your code by moving the variable hello outside of the function and into the level of the class so that all functions in the class can access this variable When you build you project I am assuming that you created a movie clip in the library then in the properties you set the class to be Location. Then dragged an instance of the Movieclip onto the stage and named it. The thing you have to be aware of is that the mouseevents you are setting up are associated with the movieclip and not the text field. It is the rolling into and out of the movieclip that will change the visibility. With this in mind you will have to have something occuping space in your movie clip, create a filled square for example. If you don't have any objects in your movieclip then the clip will not have any dimensions so a mouseover will never be registered and you will never see the text appear. You can also try adding the movieclip dynamically via actionscript by having this in a frame script: var my_mc:Location = new Location(); this.addChild(my_mc); and you rollover effect will work as well. hth, Rob - package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.display.DisplayObjectContainer; import flash.text.TextField; public class Location extends MovieClip { var hello:TextField = new TextField(); public function Location() { addEventListener(MouseEvent.MOUSE_OVER, mouseOverListener); addEventListener(MouseEvent.ROLL_OUT, mouseOutListener); addChild(hello); hello.text = this.name; hello.visible = false; } private function mouseOverListener(event:MouseEvent):void { hello.visible = true; } private function mouseOutListener(event:MouseEvent):void { hello.visible = false; } } } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
Hi Ron, Thanks for the suggestion but still no luck on my end. It seems that on my set up I need to have a constructor named the same as the .as file and that constructor has to be initiated prior to any of the other classes being initiated. So I set up public class MyPackage{ public function MyPackage{ } } and then can either do an import or set up the .as file as my document class and after that I can access HelloWorld or MyClass. This seems to follow the examples that came with the Flash 9 alpha, which all use the document class approach and none of the .as files has more than one class in them, even though you can put more than one class inside. So I'm still a bit flummoxed as to how the package is working for Jason and not me, ah well. Probably something stupid I'm doing and the light will go in a few days. Just to complete this I've also tried creating a folder called MyPackage and putting the .as files in there and again without the constructor named the same as the .as file it did not work My understanding of 'package' is that the dot path that occurs after it is the path to the .as file so if the MyPackage.as is sitting in the same directory as your .fla then I would only have 'package' at the top of the file, if it were in a directory called MyPackage then the syntax would be package MyPackage thanks for ideas, Rob On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler [EMAIL PROTECTED] wrote: Something to try change import MyPackage.*; to import myPackage.HelloWorld import myPackage.MyClass See if the errors change. Ron Merrill, Jason wrote: I dunno, that's how I have it set up and it works fine for me - Perhaps your Flash 9 Preview Alpha is messed up. I assume your publish settings are all correct, - I don't know why it would do that. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
On Mon, 26 Mar 2007 12:17:10 -0400, elibol [EMAIL PROTECTED] wrote: Here is a good article on class/package syntax and structure: http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/ ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
Hi Ron and elibol, Thanks for the explanations and link both helped straighten out my understanding of the packaging structure. Rob On Mon, 26 Mar 2007 12:17:10 -0400, elibol [EMAIL PROTECTED] wrote: Here is a good article on class/package syntax and structure: http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/ and On Mon, 26 Mar 2007 13:08:48 -0400, Ron Wheeler [EMAIL PROTECTED] wrote: The following would be a good directory structure for your documentation, sources and test specifications (there could be lots of other directories but the main one is the source directory ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
Hi Jason, My packageTest.fla is import MyPackage.*; var hw:HelloWorld = new HelloWorld(); var mc:MyClass = new MyClass(); and in the same directory I have MyPackage.as //MyPackage.as package MyPackage { public class HelloWorld { public function HelloWorld() { trace(hello world constructor); } } public class MyClass { public function MyClass() { trace(MyClass constructor); } } } In the windows Flash 9 Alpha IDE I try to run this and I get **Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 : [Compiler] Error #1046: Type was not found or was not a compile-time constant: HelloWorld. var hw:HelloWorld = new HelloWorld(); **Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 3, Column 8 : [Compiler] Error #1046: Type was not found or was not a compile-time constant: MyClass. var mc:MyClass = new MyClass(); ReferenceError: Error #1065: Variable Timeline0_f549bc2eccff3a4d88caed7024db465e is not defined. This seems to me as if it should work. I don't know if it is the Flash IDE causing me grief, if there is some preference file I don't have set correctly or what. Other than this issue I'm having a lot of fun with AS3 especially the new text features. thanks, Rob On Thu, 22 Mar 2007 20:39:14 -0400, Merrill, Jason [EMAIL PROTECTED] wrote: I have a question back at you along this example. any insights why yours can run as MyPackage.as? Do you start out your package as: package MyPackage { //class definitions } and then import like this: import MyPackage.* ? That should work. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
Try adding this to your fla addChild(hw); In your HelloWorld class you've added your textField inside but since you have added you HelloWorld() object to the display list of the movie it will never get drawn. I have a question back at you along this example. I'm running on windows and if I set up my project that I have my.fla [MyPackage] MyPackage.as (with the HelloWorld class) using the code in the fla I never get HelloWorld to properly initiate. Instead I get an error **Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 : [Compiler] Error #1046: Type was not found or was not a compile-time constant: HelloWorld. var hw:HelloWorld = new HelloWorld(); if I change the name of the .as file to HelloWorld.as then all works fine any insights why yours can run as MyPackage.as? Rob On Thu, 22 Mar 2007 09:08:45 -0400, Merrill, Jason [EMAIL PROTECTED] wrote: //MyPackage.as package MyPackage { //do I actually need this one?: import flash.display.DisplayObjectContainer; import flash.display.Sprite; import flash.text.TextField; public class HelloWorld extends Sprite { public function HelloWorld() { var message_txt:TextField = new TextField(); message_txt.text = Hello World; addChild(message_txt); //does not show! trace(constructor runs)//traces fine } } } Then in the .fla, I put: import MyPackage.* var hw:HelloWorld = new HelloWorld(); The constructor traces fine in the output window, but the TextField does not show. What have I done wrong? My Export settings in F9 As3 preview are for AS 3.0 and FP9. In later scripts, I tried moving the textfield, changing the color, changing the stage color to be sure it wasn't matching the textfield and this invisible, etc...(but it should show as black Times New Roman text by default anyway...) ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS 3.0 - Typecast a new Obj instantiated from a library linked class to a 'displayObject'
Hi Dave, I'm not sure you need to be accessing your bitmap via a movieClip. I'm doing something similar but I use the bitmap directly from the library. I se the bitmap up an auto generated class using 'Linkage' i.e. 'myBitmap' then if I need the bitmapData in yourscript simply say: var myBitmapData:myBitmap = new myBitmap(); var myBitmapInstance:Bitmap = new Bitmap(myBitmapData, auto, true); this.addChild(myBitmapInstance); No need for a movieClip. I'm going to guess that when you use the movieClip you are accessing the bitmap as a child of that movieClip and trying to extract the bitmapData from that. I tried a similar approach and it did not work. Seems that bitmaps assigned in authoring mode return a type of Shape and not Bitmap when you try to access them. I'm guessing this is a bug in the alpha version. hth, Rob On Fri, 23 Feb 2007 13:12:55 -0500, Dave Geurts [EMAIL PROTECTED] wrote: Hello, So I have a movieClip in the library that is set to Export as a class with the Auto Create Class feature, with the name rotate_sphere. rotate_sphere basically contains a .png that I would like to copy as bitmapData to a new bitmap Object so that I can take advantage of the smoothing parameter on 'New Bitmap(bitmapData,snapping,SMOOTHING)'. Because this object needs to scale and I would like to keep it looking smooth with keeping the edges anti aliased. I am getting a Type Coercion error which reads: cannot convert rotate_sphere$ to flash.display.DisplayObject when I am trying to get the bitmapData. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com