Re: [Flashcoders] Listeners (was no subject)
Hi all; I hesitated to introduce new questions to this list concerning my matter in this same thread since it has taken such interesting turns into quarks and bosons and what not, but then I thought it best if anyone were to google it to be continuous. I am in the process of joining Flash_Tiger but await moderator approval. In the interim, perhaps you could continue to help me a bit here. I am attempting the more complicated approach of custom events. I googled and the information I got was not entirely luminous (at my beginning level of understanding). Here is a slight revision of my previous code: function RotateGears() { var path:String = new String(); path = gearsPaths[displayGearsCounter]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadGearData.displayGearsCounter); } function RotateGearsLoaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = gearWidths[displayGearsCounter]; displayObject.height = gearHeights[displayGearsCounter]; //displayObject.x = - gearWidths[displayGearsCounter]; //displayObject.y = - gearWidths[displayGearsCounter]; displayObject.x = 0; displayObject.y = 0; trace(displayGearsCounter); parent_container.addChild(displayObject); parent_container.x = 0; parent_container.y = 0; parent_container.alpha = 1; addChild(parent_container); var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.append(new TweenMax(parent_container, 1, {shortRotation:{rotation:gearAngles[displayGearsCounter]}})); } } I also import the following script, which is a slight tweak of something I googled: package { import flash.events.Event; public class LoadGearData extends flash.events.Event { public static const displayGearsCounter:int = 0; private var command:String; public function LoadGearData (command:String ) { super(displayGearsCounter); this.command = command; } } } Now, what I'm trying to do is get RotateGearsLoaded() to fire with the correct value of displayGearsCounter (as it increments). I'm lost as to how to understand how calling LoadGearData() is supposed to do that. Please elucidate. TIA. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Listeners (was no subject)
- Original Message From: Taka Kojima t...@gigafied.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, July 26, 2010 1:33:43 PM Subject: Re: [Flashcoders] Listeners (was no subject) John, This is going to come across as harsh, however you really should maybe go and get a book on AS3. These problems, forgetting an import, trying to pass arguments to a listener, etc. are pretty rudimentary, and not really the purpose of this list. Yep, a little rough. Got a good book. My question isn't how to pass arguments. I know how to do that. My question is far more specific. It's why don't I have to pass the e:Event argument? Why does the compiler complain that I only pass one argument when I try to pass the other since apparently the first argument is passed automatically? How can I pass that first argument manually when I can't even see what it is? Didn't notice that Moock addressed those questions, so I thought I'd ask here. Would you be so kind as to address those questions, not how to pass arguments? TIA, John Taka On Mon, Jul 26, 2010 at 10:58 AM, John Singleton johnsingleton...@yahoo.com wrote: Original Message From: Henrik Andersson he...@henke37.cjb.net To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, July 26, 2010 12:06:55 PM Subject: Re: [Flashcoders] (no subject) John Singleton wrote: function RotateGearsLoaded(e:Event):void Why is that? I tried to pass that var like this: loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded(displayGearsCounter)); RotateGearsLoaded returns void, not Function. The return value is not a legal listener. Yet you are calling it here to get the listener to add. Remember, you are not the one calling the listener, thusly, you can't decide the arguments. That makes sense. Unfortunately, it's not clear to me how I should proceed. Could you either recommend a tutorial or give an example? TIA, John PS. Original code for those who skipped this message because it had no subject: function Main() { InitRotateGears(); } function InitRotateGears() { for (var i = 0; i gearsPaths.length; i++) { RotateGears(); displayGearsCounter += 1; } function RotateGears() { var path:String = new String(); path = gearsPaths[displayGearsCounter]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded); } function RotateGearsLoaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = gearWidths[displayGearsCounter]; displayObject.height = gearHeights[displayGearsCounter]; // displayObject.x = - gearWidths[displayGearsCounter]; // displayObject.y = - gearWidths[displayGearsCounter]; displayObject.x = 0; displayObject.y = 0; trace(displayGearsCounter); parent_container.addChild(displayObject); parent_container.x = 0; parent_container.y = 0; parent_container.alpha = 1; addChild(parent_container); var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.append(new TweenMax(parent_container, 1, {shortRotation:{rotation:gearAngles[displayGearsCounter]}})); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders s 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] Listeners (was no subject)
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, July 27, 2010 8:23:16 AM Subject: RE: [Flashcoders] Listeners (was no subject) You'll want to learn how to create custom events and pass data with those. With a custom event, you can have it contain any amount and form of data. The custom events we use in our internal development framework all have a public data property with a type wildcard *, but you can specify more specific typecast properties than that of course. Don't feel bad about your questions, I disagree with Taka I suppose, that's the point of this list and the best way to learn. If you were constantly bombarding us with newbie questions, I would probably refer you elsewhere as he did, but you aren't. If you aren't using FlashDevelop or a similar tool of equivalent power, I would recommend it. You'll know right away if you're missing an import for example, and it also will clean up your imports, removing the unused ones. Your response was incredibly helpful. Thank you very much! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] 1046 Error
Hi; I have this code which works elsewhere: public class Main extends MovieClip { var parent_container:Sprite = new Sprite(); private var displayGearsCounter:int = 0; var gearsPaths:Array = new Array(images/watch/watch-movements/back-center.png, images/watch/watch-movements/back.png, images/watch/watch-movements/middle-center.png, images/watch/watch-movements/middle.png, images/watch/watch-movements/left-center.png, images/watch/watch-movements/left.png, images/watch/watch-movements/top-center.png, images/watch/watch-movements/top.png); var angles:Array = new Array(10, 10, 10, 10, 10, 10, 10, 10); function Main() { InitRotateGears(); } function InitRotateGears() { for (var i = 0; i gearsPaths.length; i++) { RotateGears(); displayGearsCounter += 1; } function RotateGears() { var path:String = new String(); path = gearsPaths[displayGearsCounter]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded); } function RotateGearsLoaded(e:Event):void { trace('hi'); } /* function RotateGearsLoaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 150; displayObject.height = 150; displayObject.x = -150; displayObject.y = -150; TweenMax.to(displayObject, 0, {shortRotation:{rotation:60}}); parent_container.addChild(displayObject); parent_container.x = 820; parent_container.y = 537; parent_container.alpha = 1; addChild(parent_container); var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.append(new TweenLite(parent_container, 1, {shortRotation:{rotation:angles[displayGearsCounter]}})); myTimeline.append(new TweenLite(parent_container, 1, {alpha:0})); } */ Now I deliberately commented out that code that worked to test with a simple trace and nada. I get a 1046 error: 1046: Type was not found or was not a compile-time constant: Event.� [for RotateGearsLoaded(e:Event)] Why? What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] 1046 Error
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, July 26, 2010 9:58:08 AM Subject: RE: [Flashcoders] 1046 Error Where is your import flash.events.Event; statement? Ah. Oops. Thanks. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] (no subject)
Hi; I have this code: function InitRotateGears() { for (var i = 0; i gearsPaths.length; i++) { RotateGears(); displayGearsCounter += 1; } function RotateGears() { var path:String = new String(); path = gearsPaths[displayGearsCounter]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded); } function RotateGearsLoaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = gearWidths[displayGearsCounter]; displayObject.height = gearHeights[displayGearsCounter]; //displayObject.x = - gearWidths[displayGearsCounter]; //displayObject.y = - gearWidths[displayGearsCounter]; displayObject.x = 0; displayObject.y = 0; parent_container.addChild(displayObject); parent_container.x = 0; parent_container.y = 0; parent_container.alpha = 1; addChild(parent_container); var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.append(new TweenMax(parent_container, 1, {shortRotation:{rotation:gearAngles[displayGearsCounter]}})); } } The problem is that displayGearsCounter traces to value 8 every iteration in function RotateGearsLoaded(). It increments when traced in the other two functions. Why is that? I tried to pass that var like this: loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded(displayGearsCounter)); however the compiler complained that two variables were expected and only one passed. If I don't pass that var, somehow the e:Event var gets passed, and I don't understand that either. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Listeners (was no subject)
Original Message From: Henrik Andersson he...@henke37.cjb.net To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, July 26, 2010 12:06:55 PM Subject: Re: [Flashcoders] (no subject) John Singleton wrote: function RotateGearsLoaded(e:Event):void Why is that? I tried to pass that var like this: loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded(displayGearsCounter)); RotateGearsLoaded returns void, not Function. The return value is not a legal listener. Yet you are calling it here to get the listener to add. Remember, you are not the one calling the listener, thusly, you can't decide the arguments. That makes sense. Unfortunately, it's not clear to me how I should proceed. Could you either recommend a tutorial or give an example? TIA, John PS. Original code for those who skipped this message because it had no subject: function Main() { InitRotateGears(); } function InitRotateGears() { for (var i = 0; i gearsPaths.length; i++) { RotateGears(); displayGearsCounter += 1; } function RotateGears() { var path:String = new String(); path = gearsPaths[displayGearsCounter]; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,RotateGearsLoaded); } function RotateGearsLoaded(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = gearWidths[displayGearsCounter]; displayObject.height = gearHeights[displayGearsCounter]; //displayObject.x = - gearWidths[displayGearsCounter]; //displayObject.y = - gearWidths[displayGearsCounter]; displayObject.x = 0; displayObject.y = 0; trace(displayGearsCounter); parent_container.addChild(displayObject); parent_container.x = 0; parent_container.y = 0; parent_container.alpha = 1; addChild(parent_container); var myTimeline:TimelineLite = new TimelineLite({useFrames:true}); myTimeline.append(new TweenMax(parent_container, 1, {shortRotation:{rotation:gearAngles[displayGearsCounter]}})); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Function Doesn't Increment Properly
Hi; The following script fully increments the value of i every time it calls _addNewFlame. I would have thought (and need) that the value of i would be incremented with each call. Please advise. TIA, John package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import fireBall; public class Fire extends MovieClip { private var mcFlameContainer:MovieClip; private var uintMakeAFlame:uint; private var i:Number = new Number(0); public function Fire() { mcFlameContainer = new MovieClip(); addChild(mcFlameContainer); for (i; i 10; i++) { uintMakeAFlame = setInterval(_addNewFlame, 15); } } private function _addNewFlame():void { var flameNew:fireBall = new fireBall(); mcFlameContainer.addChild(flameNew); flameNew.y = 200; flameNew.x = 20 + (i * 10); } } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Function Doesn't Increment Properly
First, a word of thanks to Glen Pike. That was slick, numChildren! Second, I like Michael Mendelsohn's idea, however, for what event am I listening? package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import flash.utils.Timer; import flash.events.TimerEvent; import fireBall; public class Fire extends MovieClip { private var mcFlameContainer:MovieClip; private var uintMakeAFlame:uint; private var i:Number = new Number(0); private var kids:Number = new Number(); private var t:Timer = new Timer(15, 10); public function Fire() { mcFlameContainer = new MovieClip(); addChild(mcFlameContainer); t.addEventListener(TimerEvent.TIMER, _addNewFlame); //for (i=0; i 10; i++) //{ //uintMakeAFlame = setInterval(_addNewFlame, 15); //} } private function _addNewFlame():void { var flameNew:fireBall = new fireBall(); mcFlameContainer.addChild(flameNew); flameNew.y = 200; flameNew.x = 200; kids = mcFlameContainer.numChildren; flameNew.x = 20 + (kids * 10); trace('hi'); } } } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Function Doesn't Increment Properly
- Original Message From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Fri, June 18, 2010 11:25:24 AM Subject: Re: [Flashcoders] Function Doesn't Increment Properly t.start() ? Oh :-} Yeah, that worked. Merrill thought I was mixing the timer with setInterval, but all of that code was commented out. Thanks! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Balls Of Fire
Hi; Here's code that I found online: package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; public class Fire extends MovieClip { private var mcFlameContainer:MovieClip; private var nStageWidth:Number = 550; private var nStageHeight:Number = 400; private var uintMakeAFlame:uint; //private var uintCheckStars:uint; public function Fire ( ) { mcFlameContainer = new MovieClip (); addChild(mcFlameContainer); _addRootFlame(); uintMakeAFlame = setInterval ( _addNewFlame, 125 ); } private function _addRootFlame ( ) : void { var flameStatic:flame = new flame ( ); mcFlameContainer.addChild(flameStatic); flameStatic.y = 190; flameStatic.x = 200; } private function _addNewFlame ( ) : void { var flameNew:fireBall = new fireBall ( ); mcFlameContainer.addChild(flameNew); flameNew.y = 200; flameNew.x = 200; } } } Here's how I've tweaked it with your help: package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import flash.utils.Timer; import flash.events.TimerEvent; import fireBall; public class Fire extends MovieClip { private var mcFlameContainer:MovieClip; private var i:Number = new Number(0); private var kids:Number = new Number(); private var t:Timer = new Timer(15, 10); public function Fire() { t.start(); mcFlameContainer = new MovieClip(); addChild(mcFlameContainer); t.addEventListener(TimerEvent.TIMER, _addNewFlame); } private function _addNewFlame(event:TimerEvent):void { var flameNew:fireBall = new fireBall(); mcFlameContainer.addChild(flameNew); flameNew.y = 200; kids = mcFlameContainer.numChildren; flameNew.x = 20 + (kids * 10); } } } The problem is this new code creates fireBalls that move up on the screen, whereas it should remember its history and keep a bunch of fireBalls together to give the appearance of a flickering flame. That is, each fireBall in the group of fireBalls that make up one iteration of the timer (of which there are 10) should remain on the screen until they go up (incrementing the y positional value) to a certain height, whereupon they disappear. They don't do that. Only one fireBall goes up. I assume the reason for that is the following line: uintMakeAFlame = setInterval ( _addNewFlame, 125 ); How do I get all those fireBalls to stay put with the new code? TIA, John PS Here's the code for those fireBalls: package { import flash.display.MovieClip; import flash.utils.setInterval; import flash.utils.clearInterval; import flash.filters.GlowFilter; public class fireBall extends MovieClip { private var uintMovefireBall:uint; public function fireBall() { uintMovefireBall = setInterval (_movefireBall, 8.5); } private function _movefireBall( ):void { this.x += Math.random()-.5; this.y -= 1; this.width -= .45; if (this.width1) { clearInterval(this.uintMovefireBall); parent.removeChild(this); } } } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Time To Notify Adobe Of a Bug? Please Comment...
Hi; I sent the following email to this list a couple days ago and nobody commented, which makes me think that nobody saw a problem/solution, which makes me think that Adobe's latest Flash CS5 has a bug. So, please consider reviewing the below and, if necessary, informing me how to inform Adobe of their failure. TIA, John Ok, I've nailed down where the problem is as to why my silly little *.as file that worked so well before won't work with minor changes in my latest *.as file. The problem appears to be that Flash freaks out over different image files! Here's the code, simplified: package { import flash.display.Sprite; import flash.text.TextLineMetrics; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextFieldAutoSize; import flash.net.navigateToURL; import flash.display.Bitmap; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; import flash.display.Loader; import flash.events.ProgressEvent; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFieldAutoSize; import flash.net.URLRequest; [SWF(backgroundColor=0x565656)] public class DeJonghPreloader extends MovieClip { var loader:Loader = new Loader(); private var myTextField:TextField = new TextField(); var imgFlag1:Boolean = new Boolean(false); public function DeJonghPreloader() { addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); } private function init(e:Event) { var clientName:TextField = new TextField(); var format:TextFormat = new TextFormat(); format.font = 'Arial'; format.size = 35; clientName.textColor = 0x023048; clientName.text = 'Delta Electric'; clientName.autoSize = TextFieldAutoSize.LEFT; clientName.setTextFormat(format); var nameSprite:Sprite = new Sprite(); nameSprite.x = stage.stageWidth/2 - 70; nameSprite.y = stage.stageHeight/2 - 40; nameSprite.alpha = 0; TweenLite.to(nameSprite, 2, {alpha:1}); addChild(nameSprite); nameSprite.addChild(clientName); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); loader.load(new URLRequest(images/charles.jpg)); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop); removeEventListener(Event.ADDED_TO_STAGE, init); addChild(myTextField); myTextField.width = 250; myTextField.x = stage.stageWidth/2; myTextField.y = stage.stageHeight/2; myTextField.selectable = false; myTextField.border = false; myTextField.borderColor = 0xAA; myTextField.autoSize = TextFieldAutoSize.LEFT; var myFormat:TextFormat = new TextFormat(); myFormat.color = 0x023048; myFormat.size = 24; myFormat.italic = true; myTextField.defaultTextFormat = myFormat; } private function imageLoaded(event:Event):void { imgFlag1 = true; completePreloader(); } function completePreloader() { var req:URLRequest = new URLRequest('index.py'); navigateToURL(req, '_self'); } function loop(e:ProgressEvent):void { var perc:Number = e.bytesLoaded/e.bytesTotal; myTextField.text = Math.ceil(perc*100).toString() + %; } } } Now, that code works just fine. However, if I change the image from charles.jpg to left1.png it doesn't work. What breaks? Who knows? If I put a trace in completePreloader(), it traces, so one would thing that the URLRequest works, right? Wrong. The page is never sought, witnessed by the fact that, if charles.jpg is in, an error is traced on my Mac when trying to find the relative address, but if left1.png is in, no error. Now, it doesn't matter if it's a png or a jpg, because the original file that works has a couple pngs as well. I've gone so far as to copy and rename the working files in the same directory as the originals, prove they work, copy over my images and change them and watch this code break. So it _is_ the images that are causing the problem. But why, o why??? John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Funny, Code Worked Before...
Ok, I've nailed down where the problem is as to why my silly little *.as file that worked so well before won't work with minor changes in my latest *.as file. The problem appears to be that Flash freaks out over different image files! Here's the code, simplified: package { import flash.display.Sprite; import flash.text.TextLineMetrics; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFormatAlign; import flash.text.TextFieldAutoSize; import flash.net.navigateToURL; import flash.display.Bitmap; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import com.greensock.*; import com.greensock.easing.*; import flash.display.Loader; import flash.events.ProgressEvent; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFieldAutoSize; import flash.net.URLRequest; [SWF(backgroundColor=0x565656)] public class DeJonghPreloader extends MovieClip { var loader:Loader = new Loader(); private var myTextField:TextField = new TextField(); var imgFlag1:Boolean = new Boolean(false); public function DeJonghPreloader() { addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); } private function init(e:Event) { var clientName:TextField = new TextField(); var format:TextFormat = new TextFormat(); format.font = 'Arial'; format.size = 35; clientName.textColor = 0x023048; clientName.text = 'Delta Electric'; clientName.autoSize = TextFieldAutoSize.LEFT; clientName.setTextFormat(format); var nameSprite:Sprite = new Sprite(); nameSprite.x = stage.stageWidth/2 - 70; nameSprite.y = stage.stageHeight/2 - 40; nameSprite.alpha = 0; TweenLite.to(nameSprite, 2, {alpha:1}); addChild(nameSprite); nameSprite.addChild(clientName); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); loader.load(new URLRequest(images/charles.jpg)); loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop); removeEventListener(Event.ADDED_TO_STAGE, init); addChild(myTextField); myTextField.width = 250; myTextField.x = stage.stageWidth/2; myTextField.y = stage.stageHeight/2; myTextField.selectable = false; myTextField.border = false; myTextField.borderColor = 0xAA; myTextField.autoSize = TextFieldAutoSize.LEFT; var myFormat:TextFormat = new TextFormat(); myFormat.color = 0x023048; myFormat.size = 24; myFormat.italic = true; myTextField.defaultTextFormat = myFormat; } private function imageLoaded(event:Event):void { imgFlag1 = true; completePreloader(); } function completePreloader() { var req:URLRequest = new URLRequest('index.py'); navigateToURL(req, '_self'); } function loop(e:ProgressEvent):void { var perc:Number = e.bytesLoaded/e.bytesTotal; myTextField.text = Math.ceil(perc*100).toString() + %; } } } Now, that code works just fine. However, if I change the image from charles.jpg to left1.png it doesn't work. What breaks? Who knows? If I put a trace in completePreloader(), it traces, so one would thing that the URLRequest works, right? Wrong. The page is never sought, witnessed by the fact that, if charles.jpg is in, an error is traced on my Mac when trying to find the relative address, but if left1.png is in, no error. Now, it doesn't matter if it's a png or a jpg, because the original file that works has a couple pngs as well. I've gone so far as to copy and rename the working files in the same directory as the originals, prove they work, copy over my images and change them and watch this code break. So it _is_ the images that are causing the problem. But why, o why??? John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Funny, Code Worked Before...
Hi; I have this code: function completePreloader() { navigateToURL(new URLRequest('index.py')); trace('yep'); } that is triggered after all the assets have loaded in the preloader. It prints the trace. But it doesn't surf to the URL. It just sits there. Also, when I run the other code that works, which is basically identical, it prints this error: Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found. because it can't surf to that relative URL. But my new *.as file doesn't print that error. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Funny, Code Worked Before...
From: John Singleton johnsingleton...@yahoo.com To: Deepanjan Das deepanjan@gmail.com Sent: Thu, May 27, 2010 1:03:10 PM Subject: Re: [Flashcoders] Funny, Code Worked Before... From: Deepanjan Das href=mailto:deepanjan@gmail.com;deepanjan@gmail.com To: John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.com; ymailto=mailto:flashcoders@chattyfig.figleaf.com; href=mailto:flashcoders@chattyfig.figleaf.com;flashcoders@chattyfig.figleaf.com Sent: Thu, May 27, 2010 11:22:51 AM Subject: Re: [Flashcoders] Funny, Code Worked Before... Hi John, No in this case no need to pass the Event. Try classifying the SWF file as local-with-networking or trusted. Do I really need to go to that length? I have another script without that that works fine. When I run said script on my Mac Pro, since it can't find the relative URL, it throws an error, that the script in question here doesn't throw. If I need to do this, can you suggest how to do this? Check for allowScriptAccess=always in the containing document. I changed it to no avail :( TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flashing Flash
- Original Message From: Keith Reinfeld keithreinf...@comcast.net To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 19, 2010 1:53:06 PM Subject: RE: [Flashcoders] Flashing Flash Don't remove container_middle at all. Instead add/remove its children: container_middle.addChildAt(newImage, 0); container_middle.removeChildAt(1); Well I thought that was a pretty slick idea, and cleaner code all the way around. However, no cigar. I had to place the new code further down. Here's what I ended up with: function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); big_container.addChild(container_left) } else { big_container.removeChild(container_left2); } var path:String = images/left + i + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLeftLoaded); } function LoadLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_left.addChildAt(displayObject, 0); if(start_flag == false) { container_left.addChildAt(displayObject, 0); try { container_left.removeChildAt(1); } catch(error: Error) { trace('Error in removwChildAt(1)'); } } else { container_left.addChild(displayObject); } if(start_flag2 == true) { container_left.x = 1000; container_left.y = 20; } else { container_left.x = 30; container_left.y = 20; } var timeline:TimelineLite = new TimelineLite({onComplete:SpinLeft}); timeline.append(new TweenLite(container_left, 1, {x:30, y:20})); } Nonetheless, it still blinks at me as before :( TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flashing Flash
Hi; I have this code: big_container.removeChild(container_middle); big_container.removeChild(container_middle2); container_middle = new Sprite(); big_container.addChild(container_middle) It loops and is called in each iteration except the first. The problem is, when it runs, the image in the container momentarily disappears then reappears, which doesn't look good. How work around this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Changing Values Programmatically
Full View Hi; I have the following code. When it runs through BigContainer the second time, for some reason my containers disappear and nothing shows on the screen. This happens even if I take out my removeChild statements, and that's what's got me puzzled. Ideas? var start_flag:Boolean = true; var start_flag2:Boolean = true; function BigContainer() { if(start_flag == false) { start_flag2 = false; } if(start_flag == true) { LoadImages(); start_flag = false; } else { if(i == 4) { i = 1; } else if(i == 3) { j = 1; } var timeline:TimelineLite = new TimelineLite({onComplete:LoadImages()}); timeline.append(new TweenLite(container_left, 3, {alpha: 1})); } } function LoadImages() { LoadLeft(); } function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); } else { big_container.removeChild(container_left); container_left = container_left2; } big_container.addChild(container_left) var path:String = images/left + i + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLeftLoaded); } function LoadLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; big_container.removeChild(container_left2); container_left.addChild(displayObject); if(start_flag2 == true) { container_left.x = 1000; container_left.y = 20; } else { container_left.x = 30; container_left.y = 20; } var timeline:TimelineLite = new TimelineLite({onComplete:SpinLeft}); timeline.append(new TweenLite(container_left, 1, {x:30, y:20})); } function SpinLeft() { big_container.addChild(container_left2) var path:String = images/left + j + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SpinLeftLoaded); } function SpinLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_left2.addChild(displayObject); container_left2.x = 30; container_left2.y = -482; var rand:Number = new Number(randomNumber(rand_low, rand_high)); var timeline:TimelineLite = new TimelineLite({onComplete: CompleteLeft}); timeline.append(new TweenLite(container_left, rand/100, {alpha: 1})); timeline.append(new TweenLite(container_left, 1, {x:30, y:522})); var timeline2:TimelineLite = new TimelineLite(); timeline2.append(new TweenLite(container_left2, rand/100, {alpha: 1})); timeline2.append(new TweenLite(container_left2, 1, {x:30, y:20})); } function CompleteLeft() { left_done = true; AllDone(); } function AllDone() { if(right_done == true mid_done == true left_done == true) { right_done = false; mid_done = false; left_done = false; i += 1; j += 1; BigContainer() } } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Event Listeners
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 13, 2010 2:56:28 PM Subject: RE: [Flashcoders] Event Listeners OK, then you're AllDone(). :) LOL! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Changing Containers
Hi; I have this: big_container.removeChild(container_middle); container_middle = container_middle2; big_container.addChild(container_middle); I'm trying to change container_middle to container_middle2 but keep the same name so that I can manipulate it programmatically. Unfortunately, the above code doesn't work. I only succeed in removing the first container. How shall I do this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing Containers
This appears to be more complex than I originally anticipated. Here is more complete code: var start_flag:Boolean = true; var start_flag2:Boolean = true; function BigContainer() { if(start_flag == false) { start_flag2 = false; } if(start_flag == true) { LoadImages(); start_flag = false; } else { if(i == 4) { i = 1; } else if(i == 3) { j = 1; } var timeline:TimelineLite = new TimelineLite({onComplete:LoadImages()}); timeline.append(new TweenLite(container_left, 3, {alpha: 1})); } } function LoadImages() { LoadLeft(); } function LoadLeft():void { if(start_flag == true) { container_left = new Sprite(); } else { big_container.removeChild(container_left); container_left = container_left2; } big_container.addChild(container_left) var path:String = images/left + i + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLeftLoaded); } function LoadLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; big_container.removeChild(container_left2); container_left.addChild(displayObject); if(start_flag2 == true) { container_left.x = 1000; container_left.y = 20; } else { container_left.x = 30; container_left.y = 20; } var timeline:TimelineLite = new TimelineLite({onComplete:SpinLeft}); timeline.append(new TweenLite(container_left, 1, {x:30, y:20})); } function SpinLeft() { big_container.addChild(container_left2) var path:String = images/left + j + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SpinLeftLoaded); } function SpinLeftLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_left2.addChild(displayObject); container_left2.x = 30; container_left2.y = -482; var rand:Number = new Number(randomNumber(rand_low, rand_high)); var timeline:TimelineLite = new TimelineLite({onComplete: CompleteLeft}); timeline.append(new TweenLite(container_left, rand/100, {alpha: 1})); timeline.append(new TweenLite(container_left, 1, {x:30, y:522})); var timeline2:TimelineLite = new TimelineLite(); timeline2.append(new TweenLite(container_left2, rand/100, {alpha: 1})); timeline2.append(new TweenLite(container_left2, 1, {x:30, y:20})); } function CompleteLeft() { left_done = true; AllDone(); } function AllDone() { if(right_done == true mid_done == true left_done == true) { right_done = false; mid_done = false; left_done = false; i += 1; j += 1; BigContainer() } } When it runs through BigContainer the second time, for some reason my containers disappear and nothing shows on the screen. This happens even if I take out my removeChild statements, and that's what's got me puzzled. Ideas? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Reusing a Mask
Hi; Possible? How? Here's the mask I'd like to reuse. I can obviously pull it out and put it in the general function for the class so it is available for all other functions, but that ain't good enough: var square:Sprite = new Sprite(); addChild(square); square.graphics.lineStyle(3,0xee1d25); square.graphics.beginFill(0xff); square.graphics.moveTo(0,0); square.graphics.lineStyle(3, 0xFF); square.graphics.beginFill(0xff); square.graphics.lineTo(957,0); square.graphics.lineTo(957,502); square.graphics.lineTo(0,502); square.graphics.endFill(); square.x = 30; square.y = 20; container_left.mask = square; TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: Reusing a Mask
Oops. Just realized could make a master container and just apply the mask to that :-} John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Event Listeners
Hi; I struggle with event listeners and knowing to what objects to attach them. I have the following code: function SpinMiddle() { big_container.addChild(container_middle2) var path:String = images/mid + j + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SpinMiddleLoaded); } function SpinMiddleLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_middle2.addChild(displayObject); container_middle2.x = 349; container_middle2.y = -482; mid_done = true; var rand:Number = new Number(randomNumber(300, 500)); var timeline:TimelineLite = new TimelineLite({onComplete: RemoveMiddle()}); timeline.append(new TweenLite(container_middle, rand/100, {alpha: 1})); timeline.append(new TweenLite(container_middle, 1, {x:349, y:522})); var timeline2:TimelineLite = new TimelineLite(); timeline2.append(new TweenLite(container_middle2, rand/100, {alpha: 1})); timeline2.append(new TweenLite(container_middle2, 1, {x:349, y:20})); } function RemoveMiddle() { container_middle2.addEventListener(Event.COMPLETE, AllDone); } AllDone() is never called, even though a trace in RemoveMiddle() traces. I've tried replacing container_middle2 with big_container in RemoveMiddle() but with no luck. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Event Listeners
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 13, 2010 2:11:39 PM Subject: RE: [Flashcoders] Event Listeners To answer your question, it's a matter of a where and a when which are not apparent in your sample code. Where is the event Event.COMPLETE dispatched from container_middle2? When does that event fire? Are you possibly assigning the listener after the event has already fired? How stupid of me. I made this far more complex than I need. Forget that handler. All I need is this: AllDone(); Duh. Sorry. John 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: ymailto=mailto:flashcoders-boun...@chattyfig.figleaf.com; href=mailto:flashcoders-boun...@chattyfig.figleaf.com;flashcoders-boun...@chattyfig.figleaf.com [mailto: ymailto=mailto:flashcoders-boun...@chattyfig.figleaf.com; href=mailto:flashcoders-boun...@chattyfig.figleaf.com;flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Thursday, May 13, 2010 2:06 PM To: ymailto=mailto:flashcoders@chattyfig.figleaf.com; href=mailto:flashcoders@chattyfig.figleaf.com;flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Event Listeners Hi; I struggle with event listeners and knowing to what objects to attach them. I have the following code: function SpinMiddle() { big_container.addChild(container_middle2) var path:String = images/mid + j + .png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, SpinMiddleLoaded); } function SpinMiddleLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 319; displayObject.height = 502; container_middle2.addChild(displayObject); container_middle2.x = 349; container_middle2.y = -482; mid_done = true; var rand:Number = new Number(randomNumber(300, 500)); var timeline:TimelineLite = new TimelineLite({onComplete: RemoveMiddle()}); timeline.append(new TweenLite(container_middle, rand/100, {alpha: 1})); timeline.append(new TweenLite(container_middle, 1, {x:349, y:522})); var timeline2:TimelineLite = new TimelineLite(); timeline2.append(new TweenLite(container_middle2, rand/100, {alpha: 1})); timeline2.append(new TweenLite(container_middle2, 1, {x:349, y:20})); } function RemoveMiddle() { container_middle2.addEventListener(Event.COMPLETE, AllDone); } AllDone() is never called, even though a trace in RemoveMiddle() traces. I've tried replacing container_middle2 with big_container in RemoveMiddle() but with no luck. Please advise. TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] IE6 Troubles
- Original Message From: Hans Wichman j.c.wich...@objectpainters.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, May 4, 2010 1:36:41 PM Subject: Re: [Flashcoders] IE6 Troubles Hi, you might wanna try something like href=http://www.teamviewer.com;www.teamviewer.com , setup a session with your client and poke at the heart of the problem. This looks good. I'll have to wait till the client is back in town. Thanks! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 6, 2010 11:08:04 AM Subject: 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. I would assume it was my own fault. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] LoaderInfo(root.loaderInfo).parameters question
Hi; I have the following code: var paramObj:Object = LoaderInfo(root.loaderInfo).parameters; var myFlashVar:String = new String(); public function DeltaMain() { for (varName in paramObj) { myFlashVar = String(paramObj[varName]); } other stuff... function MyTextBlock() { myText.htmlText = pageDetails; myText.htmlText += myFlashVar; myText.setTextFormat(format); addChild(myText); I have this in my html: object classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354' width='1008' height='548' id='deltaMain' name='deltaMain' param name='movie' value='DeltaMain.swf' param name='allowfullscreen' value='true' param name='allowscriptaccess' value='always' param name=FlashVars value=pg_name=index / embed id='deltaMain' name='deltaMain' src='DeltaMain.swf' width='1008' height='548' allowscriptaccess='always' allowfullscreen='true' / /object Everything works fine, except that it doesn't print out myFlashVar and I don't know how else to test it. My eventual goal, of course, is to change the text that shows up in the swf based on the value of that var. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] LoaderInfo(root.loaderInfo).parameters question
Never mind. I figured this out. I didn't include all the necessary code in my html. John - Original Message From: John Singleton johnsingleton...@yahoo.com To: flashcoders@chattyfig.figleaf.com Sent: Fri, May 7, 2010 11:30:08 AM Subject: [Flashcoders] LoaderInfo(root.loaderInfo).parameters question Hi; I have the following code: var paramObj:Object = LoaderInfo(root.loaderInfo).parameters; var myFlashVar:String = new String(); public function DeltaMain() { for (varName in paramObj) { myFlashVar = String(paramObj[varName]); } other stuff... function MyTextBlock() { myText.htmlText = pageDetails; myText.htmlText += myFlashVar; myText.setTextFormat(format); addChild(myText); I have this in my html: object classid='clsid:D27CDB6E-AE6D-11cf-96B8-44455354' width='1008' height='548' id='deltaMain' name='deltaMain' param name='movie' value='DeltaMain.swf' param name='allowfullscreen' value='true' param name='allowscriptaccess' value='always' param name=FlashVars value=pg_name=index / embed id='deltaMain' name='deltaMain' src='DeltaMain.swf' width='1008' height='548' allowscriptaccess='always' allowfullscreen='true' / /object Everything works fine, except that it doesn't print out myFlashVar and I don't know how else to test it. My eventual goal, of course, is to change the text that shows up in the swf based on the value of that var. Please advise. TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;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
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] 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
- 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
[Flashcoders] XML Question
Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE 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(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: 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(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank 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
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:53:53 AM Subject: Re: [Flashcoders] XML Question It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. Right. That's what I said at the outset, that I knew I was doing something fundamentally wrong, but don't know how to do it correctly. Here I am with Moock trying to figure it out but I'm missing it. Could you give an example? TIA, John -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe href=mailto:jonathangh...@gmail.com;jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton ymailto=mailto:johnsingleton...@yahoo.com; href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;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
- 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
Re: [Flashcoders] Template w/ XML?
- Original Message From: Jared jared.stan...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Fri, April 30, 2010 6:16:37 PM Subject: Re: [Flashcoders] Template w/ XML? Try root.loaderinfo.parameters.varname That got me on the right track. I have one little wrinkle to work out of this first attempt. Here's my code: package { imports here class suchandsuch extends MovieClip { var pageDetails:String = new String(); var urlXMLLoader:URLLoader; function suchandsuch() { XMLLoader(); Text(); } function XMLLoader() { var urlXMLRequest:URLRequest = new URLRequest('pageDetails.xml'); urlXMLLoader = new URLLoader(); urlXMLLoader.addEventListener(Event.COMPLETE, completeXMLListener); urlXMLLoader.load(urlXMLRequest); } function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); pageDetails = xmlData.DETAILS.toString(); } function Text() { more stuff here myText.htmlText = pageDetails; myText.htmlText += Lorem ipsum dolor sitipsum, convallis consequat orci.br /br /; more stuff Now, if I put a trace under this line: myText.htmlText = pageDetails; I get : [object textField] which is what I want. But it doesn't print anything to screen. If I put the following trace under this line: pageDetails = xmlData.DETAILS.toString(); trace(pageDetails); it traces out what I want. No errors. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Template w/ XML?
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, May 4, 2010 10:27:57 AM Subject: RE: [Flashcoders] Template w/ XML? You're setting the text in the text field before the handler (completeXMLListener) even runs. That did it! Thanks for the other (bonus?) advise, too! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] IE6 Troubles
Hi; I have one site in particular that has problems with IE6. I can't see them from my Mac. I've tried installing s/w that simulates IE6 without luck. I don't know where to go to look at the problem so I can troubleshoot it. My client's computers that have IE6 are a couple thousand miles away. I tried Adobe's new BrowserLab, which is awesome, but unfortunately you can't click the links which is where the problem is. Any ideas on where to go to troubleshoot? Is there some resource to show me common problems with IE6? Developing in CS4. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Template w/ XML?
Hi; I've built a template for a Web site that I'd like to use for all pages, but be able to change the content of each page. Now, if I were programming in, say, PHP, I could write a script that could determine which page is being called and then from there call data pertinent only to that page and insert it into the template. I imagine I can do the same thing in AS3, perhaps even in a swf, that would then call data out of, say, an XML file, but how? Any tutorials on this? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Template w/ XML?
- Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Fri, April 30, 2010 10:36:24 AM Subject: Re: [Flashcoders] Template w/ XML? hi john xml is the de-facto way of externalising data for flash (there are others but xml is the best imo) and as3 implements e4x (as2 was much more clunky for this) Right. But that wasn't my question. What I'd like to know is if it's possible to alter how a swf is displayed dependent on variable information. For example: 1) visitor surfs to xyz.php 2) php script calls the template with the swf and feeds it the variable page='xyz'. 3) the template swf renders data based on that. Is that possible? If it is, then I'm sure E4X is the way to go. And if it is possible, can one alter the guts of the page such that one can build tables, include pics, etc? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Infinitely Looping Image
Hi; I would like to have a background image of clouds loop infinitely.Here's my code: function BigPic():void { parent_container2 = new MovieClip(); var square:Sprite = new Sprite(); parent_container2.mask = square; addChild(square); square.graphics.lineStyle(3,0x065566); square.graphics.beginFill(0xff); square.graphics.drawRoundRect(22, 22, 966, 146, 20); square.graphics.endFill(); addChild(parent_container2) var path:String = images/clouds.png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, BigPicLoaded); } function BigPicLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 2000; displayObject.height = 150; displayObject.x = 20; displayObject.y = 20; parent_container2.addChild(displayObject); // TweenLite.to(parent_container2, 50, {x:-1000}); cloudTween.addEventListener(TweenEvent.MOTION_FINISH, restartAnimation); } function restartAnimation(oEvent:Event):void { cloudTween.start(); } But it ain't working. Ideas? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Infinitely Looping Image
From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, April 26, 2010 10:17:10 AM Subject: Re: [Flashcoders] Infinitely Looping Image snip Hi, John, The first reference to cloudTween I see is here: cloudTween.addEventListener(TweenEvent.MOTION_FINISH, restartAnimation); So I'm guessing you need to declare and assign that object before you try attaching an event listener to it. /snip Sorry. The var is declared early on: var cloudTween:Tween = new Tween(parent_container2,x,null,0,300,1,true); snip In the future, the quality of the feedback you'll get will reflect the effort you put into describing the problem. It ain't working isn't helpful for someone analysing: Throws an exception? Doesn't compile? Animation starts but then doesn't loop? /snip Doesn't play. Everything else pops up fine. No errors. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Infinitely Looping Image
- Original Message From: Jack Doyle j...@greensock.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, April 26, 2010 12:36:45 PM Subject: RE: [Flashcoders] Infinitely Looping Image You're mixing Tween and TweenLite code. You've got an event listener set up I thought I'd commented out the TweenLite code, right? for a TweenEvent.MOTION_FINISH but TweenLite doesn't dispatch events (TweenMax does though), and you didn't define your cloudTween variable. The easiest thing to do would be to use TweenMax and its repeat property, setting it to -1 for infinite: Well the problem there and with onComplete is that the clouds image has to move completely off the stage, trailing ugly white space the whole way, before the repeat kicks in. Can't have that ;) Other ideas? TIA, John PS. Here's that code again: var cloudTween:Tween = new Tween(parent_container2,x,null,0,300,1,true); function BigPic():void { parent_container2 = new MovieClip(); var square:Sprite = new Sprite(); parent_container2.mask = square; addChild(square); square.graphics.lineStyle(3,0x065566); square.graphics.beginFill(0xff); square.graphics.drawRoundRect(22, 22, 966, 146, 20); square.graphics.endFill(); addChild(parent_container2) var path:String = images/clouds.png; var req:URLRequest = new URLRequest(path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) }); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, BigPicLoaded); } function BigPicLoaded(evt:Event):void { var loaderInfo:LoaderInfo = evt.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = 2000; displayObject.height = 150; displayObject.x = 20; displayObject.y = 20; parent_container2.addChild(displayObject); //TweenLite.to(parent_container2, 50, {x:-1000}); cloudTween.addEventListener(TweenEvent.MOTION_FINISH, restartAnimation); } function restartAnimation(oEvent:Event):void { cloudTween.start(); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] container w/ text
Hi; I have this code: function Text() { parent_container5 = new Sprite(); addChild(parent_container5); //parent_container5.width = stage.stageWidth/2; //parent_container5.height = stage.stageWidth/4; parent_container5.x = 50; parent_container5.y = 350; var myText:TextField = new TextField(); var format:TextFormat = new TextFormat(); format.font = 'Arial'; format.size = 12; myText.textColor = 0x00; myText.autoSize = TextFieldAutoSize.LEFT; myText.x = 0; myText.y = 0; myText.htmlText = Lorem ipsum dolor sit amet; myText.setTextFormat(format); parent_container5.addChild(myText); } All works well except when I uncomment the width and height lines. How do I set the width and height so that I can contain my text within it? Also, when I add br / or p.../p to my htmlText it doesn't have any effect. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: swf doesn't work the same online
From: Valentin Schmidt v...@dasdeck.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 3:28:52 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online quote first, your emails are a bit hard to read, I'd suggest to quote correctly (see e.g. http://mailformat.dan.info/quoting/), or better, use an email client that takes care of correct quoting (and configure it accordingly). /quote I don't see that yahoo affords me the opportunity to do other than I have done above. Bummer ;( quote second, I have the impression that this thread could go on forever without getting anywhere. Maybe it would be a good idea to do a fresh start, and this time first create a clear conception of what you want to achieve (in each function), e.g. by describing it in plain english, before writing your actual code? /quote OK. I have: 1) Created a preloader which preloads two graphics, one of which is rather large. 2) These graphics, in turn, are used as assets in two swf files. 3) The first of these swf files is displayed only when the visitor visits the home page. 4) BOTH of these swf files are scripted into a template that is used for all pages. The first of them displays over the second (when it's the home page) and then is removed using css. This is why I can't have a traditional preloader page: I need to preserve those assets and not have them re-loaded whenever the splash page disappears and reveals the regular page with the second swf as an element within the html page that is generated from the template. Now, the problem is that, for some reason, the preloader always, without fail, loads the graphics. It never seems to check if these graphics were cached, even though they were in fact cached in the browser. I wonder if the reason it doesn't check could be because I don't add the graphics to the stage (addChild), since I don't want them to appear on stage. quote but if you don't want to this, maybe you could extract the problematic part into a simple demo movie and put the FLA online, so anyone interested can download and fix the code? I think that makes more sense than posting longe code extracts here which then even aren't your actual code. /quote I don't believe that would help. All you'll see is: 1) a counter showing how much is loaded, then; 2) a splash page, finally; 3) the template In other words, exactly what I've already described. I hope I've clarified the problem. Thanks, John. just my 2 cts. cheers, valentin ___ 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] Re: swf doesn't work the same online
From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, March 11, 2010 10:45:38 AM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Let's see if my changes to Yahoo options translate this to plain text now ;) quote I am guessing that your browser caching is turned off and that you are testing in the browser, not the IDE? /quote Browser caching is not turned off, no. Yes, I am testing in the browser not the IDE. quote What happens if you try Work Offline? /quote If I were to rewrite my code in pure HTML (which it isn't, just translates for the browser) and do as you say, it would pop up almost immediately because it's all right here on a screaming fast Mac Pro. It struck me at this point, after already trying LiveHTTPHeaders, which is pretty darn cool, that maybe the problem I'm running into is caused by not being able to get my swf files to load in my newly downloaded FireFox, Apparently, Flash doesn't come bundled (amazing). I tried downloading and installing it from Adobe, three times, and it doesn't want to install. It isn't trying to install like other plugins. So I went to install Charles and unfortunately it assumed I wanted to install it in FF not in Safari. So I'm back to square one. How do I get FF to cooperate? quote Are you able to look at the actual cache on your computer to see if they are there? /quote Yes, they're there, even though I can't display them. Then I clean them out. quote If you are using Firefox, can you use something like the LiveHTTPHeaders add on to see the request for the SWF and whether the server sends back NOT MODIFIED. /quote I can't find anywhere where it downloads the swf. I didn't find the words NOT MODIFIED anywhere. Pity I can't copy and paste then search the output :( Thanks, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: swf doesn't work the same online
From: Glen Pike postmas...@glenpike.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, March 8, 2010 3:04:47 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online var nNavs:Array = new Array(); for(var i:int = 0; i numLinks;i++) { var nav:Sprite = nav(nNames[i], nUrls[i], positions[i], 0x0e778a); It throws error 1067 on the above line: implicit coercion of value type void to an unrelated type flash.display.Sprite, which frankly makes sense; however, I'm not sure how I should create the variable to push it onto the stack by doing otherwise. Thanks, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: swf doesn't work the same online
From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 12:22:03 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Hi, You need to make your nav function return the sprite it creates, so change the signature to: function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite and return nsprite at the bottom. Thanks. That worked. Now I see that in your original instructions. Oops. I was doing this piecemeal and testing as I went along, sorry. Now I get this error: Error: 1119: Access to possibly undefined property mynav... I figured that might have something to do with not having defined bgcolor, so I added the following in the class' function definition: var bgcolor:uint = new uint(); However, that then threw a new error: Error #1151: A conflict exists with definition bgcolor This, I assume, because of the following line: function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite That's the only place where that variable shows up and it of course is used in that function. I guess I'm confused as to how to work with those variables outside of the nav function, as you have me call them here: function onRolloverHandler(e:MouseEvent):void { var nsprite:Sprite = e.currentTarget as Sprite; if(nsprite nsprite.mynav) { TextField(nsprite.mynav).bgcolor = 0x97f9ec; } } which, of course, is where I'm getting in trouble. Thanks, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: swf doesn't work the same online
From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 1:26:14 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Sorry, my typo / error. You need to change bgcolor to backgroundColor in the event handler functions (bgcolor is not a property of TextField), e.g. TextField(nsprite.mynav).backgroundColor = 0x... No, I caught that and made the appropriate substitution. My vars are actually different than what I'm posting. That's not the problem. Please take a look at what I sent earlier. Thanks, John John Singleton wrote: From: Glen Pike g...@engineeredarts.co.uk To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tue, March 9, 2010 12:22:03 PM Subject: Re: [Flashcoders] Re: swf doesn't work the same online Hi, You need to make your nav function return the sprite it creates, so change the signature to: function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite and return nsprite at the bottom. Thanks. That worked. Now I see that in your original instructions. Oops. I was doing this piecemeal and testing as I went along, sorry. Now I get this error: Error: 1119: Access to possibly undefined property mynav... I figured that might have something to do with not having defined bgcolor, so I added the following in the class' function definition: var bgcolor:uint = new uint(); However, that then threw a new error: Error #1151: A conflict exists with definition bgcolor This, I assume, because of the following line: function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite That's the only place where that variable shows up and it of course is used in that function. I guess I'm confused as to how to work with those variables outside of the nav function, as you have me call them here: function onRolloverHandler(e:MouseEvent):void { var nsprite:Sprite = e.currentTarget as Sprite; if(nsprite nsprite.mynav) { TextField(nsprite.mynav).bgcolor = 0x97f9ec; } } which, of course, is where I'm getting in trouble. Thanks, 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] swf doesn't work the same online
Hi; I built a swf that works the way I want it in Flash, but when I upload it, it acts differently! I built buttons in as3 like this: function nav(nname:String, nurl:String, myX:int, bgcolor:uint):void { myfont2 = 'Arial'; mydize = 15; mytxtcolor = 0x00; myborder = true; mybordercolor = 0xFF; myY = 170; myfill = 0x97f9ec; mynav = new TextField(); var format:TextFormat = new TextFormat(); format.font = myfont2; format.size = mysize; mynav.htmlText = 'a href=' + nurl + '.html' + nname + '/a'; mynav.textColor = myTextColor; mynav.border = myborder; mynav.borderColor = mybordercolor; mynav.background=true; mynav.backgroundColor = bgcolor; mynav.autoSize = TextFieldAutoSize.LEFT; mynav.x = myX; mynav.y = myY; mynav.setTextFormat(format); var navdrop:DropShadowFilter = new DropShadowFilter(); navdrop.color = 0x00; navdrop.blurX = 3; navdrop.blurY = 3; navdrop.angle = 0; navdrop.alpha = 0.5; navdrop.distance = 3; var navfilters:Array = new Array(navdrop); mynav.filters = navFiltersArray; var nsprite:Sprite = new Sprite(); addChild(nsprite); nsprite.name = nname; nsprite.addChild(mynav); var len:int = mynav.numLines; for (var i:int = 0; i len; i++) { var metrics:TextLineMetrics = mynav.getLineMetrics(i); with(nsprite.graphics) { beginFill(myfill, 1); drawRect(mynav.x, mynav.y, metrics.width + 4, metrics.height + metrics.descent + 1); endFill(); } } addChild(nsprite); nsprite.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler); nsprite.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler); nsprite.addEventListener(MouseEvent.CLICK, onClickHandler); nsprite.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler); nsprite.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler); nsprite.mouseChildren = false; nsprite.buttonMode = true; } function onRollOverHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { Navigation(' Home ', 'index', 235, 0x97f9ec); } } function onRollOutHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { Navigation(' Home ', 'index', 235, 0x0e778a); } function onClickHandler(e:MouseEvent) { mynav.textColor = 0x00; mynav.borderColor = 0xFF; } function onPressHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { Navigation(' Home ', 'index', 235, 0xff); } } function onReleaseHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { Navigation(' Home ', 'index', 235, 0x0e778a); } } I can't figure out why it doesn't work online like it does in Flash. Online, it's all broken. Is this common? What should I do? Thanks, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] swf doesn't work the same online
From: Valentin Schmidt v...@dasdeck.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Mon, March 8, 2010 1:48:18 PM Subject: Re: [Flashcoders] swf doesn't work the same online Hi; I built a swf that works the way I want it in Flash, but when I upload it, it acts differently! I built buttons in as3 like this: your code is corrupted: function onRollOutHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { Navigation(' Home ', 'index', 235, 0x0e778a); } the IF statement is not closed! No, the if statements were closed. I just edited some stuff out and missed that. The code works perfectly well in the swf in my Flash, and that's what confuses me. John cheers, valentin ___ 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] Re: swf doesn't work the same online
Here's the complete code. Again, all this works fine in my swf in Flash, but when I upload the swf it breaks when I roll over Home. The color changes and won't change back when I roll out. No other nav widget works at all. function nav(nname:String, nurl:String, myX:int, bgcolor:uint):void { myfont2 = 'Arial'; mydize = 15; mytxtcolor = 0x00; myborder = true; mybordercolor = 0xFF; myY = 170; myfill = 0x97f9ec; mynav = new TextField(); var format:TextFormat = new TextFormat(); format.font = myfont2; format.size = mysize; mynav.htmlText = 'a href=' + nurl + '.html' + nname + '/a'; mynav.textColor = myTextColor; mynav.border = myborder; mynav.borderColor = mybordercolor; mynav.background=true; mynav.backgroundColor = bgcolor; mynav.autoSize = TextFieldAutoSize.LEFT; mynav.x = myX; mynav.y = myY; mynav.setTextFormat(format); var navdrop:DropShadowFilter = new DropShadowFilter(); navdrop.color = 0x00; navdrop.blurX = 3; navdrop.blurY = 3; navdrop.angle = 0; navdrop.alpha = 0.5; navdrop.distance = 3; var navfilters:Array = new Array(navdrop); mynav.filters = navFiltersArray; var nsprite:Sprite = new Sprite(); addChild(nsprite); nsprite.name = nname; nsprite.addChild(mynav); var len:int = mynav.numLines; for (var i:int = 0; i len; i++) { var metrics:TextLineMetrics = mynav.getLineMetrics(i); with(nsprite.graphics) { beginFill(myfill, 1); drawRect(mynav.x, mynav.y, metrics.width + 4, metrics.height + metrics.descent + 1); endFill(); } } addChild(nsprite); nsprite.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler); nsprite.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler); nsprite.addEventListener(MouseEvent.CLICK, onClickHandler); nsprite.addEventListener(MouseEvent.MOUSE_DOWN, onPressHandler); nsprite.addEventListener(MouseEvent.MOUSE_UP, onReleaseHandler); nsprite.mouseChildren = false; nsprite.buttonMode = true; } function onRollOverHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { nav(' Home ', 'index', 235, 0x97f9ec); } else if (e.currentTarget.name == ' Bathroom ') { nav(' Bathroom ', 'Bathroom', 295, 0x97F9EC); } else if (e.currentTarget.name == ' Bedroom ') { nav(' Bedroom ', 'Bedroom', 415, 0x97F9EC); } else if (e.currentTarget.name == ' Dining Room ') { nav(' Dining Room ', 'Dining_Room', 485, 0x97F9EC); } else if (e.currentTarget.name == ' Forms ') { nav(' Forms ', 'Forms', 642, 0x97F9EC); } else if (e.currentTarget.name == ' About Us ') { nav(' About Us ', 'About_Us', 703, 0x97F9EC); } else if (e.currentTarget.name == ' Contact Us ') { nav(' Contact Us ', 'Contact_Us', 782, 0x97F9EC); } } function onRollOutHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { nav(' Home ', 'index', 235, 0x0e778a); } else if (e.currentTarget.name == ' Bathroom ') { nav(' Bathroom ', 'Bathroom', 295, 0x0e778a); } else if (e.currentTarget.name == ' Bedroom ') { nav(' Bedroom ', 'Bedroom', 415, 0x0e778a); } else if (e.currentTarget.name == ' Dining Room ') { nav(' Dining Room ', 'Dining_Room', 485, 0x0e778a); } else if (e.currentTarget.name == ' Forms ') { nav(' Forms ', 'Forms', 642, 0x0e778a); } else if (e.currentTarget.name == ' About Us ') { nav(' About Us ', 'About_Us', 703, 0x0e778a); } else if (e.currentTarget.name == ' Contact Us ') { nav(' Contact Us ', 'Contact_Us', 782, 0x0e778a); } } function onClickHandler(e:MouseEvent) { mynav.textColor = 0x00; mynav.borderColor = 0xFF; } function onPressHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { nav(' Home ', 'index', 235, 0xff); } else if (e.currentTarget.name == ' Bathroom ') { nav(' Bathroom ', 'Bathroom', 295, 0xff); } else if (e.currentTarget.name == ' Bedroom ') { nav(' Bedroom ', 'Bedroom', 415, 0xff); } else if (e.currentTarget.name == ' Dining Room ') { nav(' Dining Room ', 'Dining_Room', 485, 0xff); } else if (e.currentTarget.name == ' Forms ') { nav(' Forms ', 'Forms', 642, 0xff); } else if (e.currentTarget.name == ' About Us ') { nav(' About Us ', 'About_Us', 703, 0xff); } else if (e.currentTarget.name == ' Contact Us ') { nav(' Contact Us ', 'Contact_Us', 782, 0xff); } } function onReleaseHandler(e:MouseEvent) { if (e.currentTarget.name == ' Home ') { nav(' Home ', 'index', 235, 0x0e778a); } else if (e.currentTarget.name == ' Bathroom ') { nav(' Bathroom