[Flashcoders] as3 sound and swf overriding one another
Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 sound and swf overriding one another
Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 sound and swf overriding one another
Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 sound and swf overriding one another
Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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] as3 sound and swf overriding one another
Apologies, I misunderstood what you wanted to do. If you google around for sound and embedded flv people seem to be having a few problems so I am guessing this may be a bigger issue and would not surprise me if there is a bug in there somewhere or maybe a feature of the player. I had one a while ago where calling stopallsounds stopped all sounds, across every browser tab - f*g annoying if you are listening to internet radio or similar. Sorry I can't be any more help... Glen quinrou . wrote: Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
no problem, I think i have sort of managed to locate the bug to when and where it occures My mp3 stops playing everytime a swf gets loaded regardless of it containing a flv or not. this pure madness... thanks On Tue, May 6, 2008 at 2:08 PM, Glen Pike [EMAIL PROTECTED] wrote: Apologies, I misunderstood what you wanted to do. If you google around for sound and embedded flv people seem to be having a few problems so I am guessing this may be a bigger issue and would not surprise me if there is a bug in there somewhere or maybe a feature of the player. I had one a while ago where calling stopallsounds stopped all sounds, across every browser tab - f*g annoying if you are listening to internet radio or similar. Sorry I can't be any more help... Glen quinrou . wrote: Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
the completeHandler is only to re dispatch the channels SOUND_COMPLETE private function completeHandler(event: Event): void { dispatchEvent(new Event(Event.SOUND_COMPLETE)); } The Application (the mp3 player in this case) listens to the SOUND_COMPLETE and then starts a new song, after the new url is taken from the playlist. No fancy stuff there ;) Folkert quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flash Unicode issue (Latin extended Romanian chars)
Hi, I have run into problems with a flash project that needs to cover most european languages including Romanian, Slovenian, Slovakian etc. The problem is that the characters listed below won't appear: Unicode Upper Unicode Lower 00C2 Â 00E2 â 0102 Ă 0103 ă 00CE Î 00EE î 015E Ş 015F ş 0162 Ţ 0163 ţ  I am hard-coding the actual texts in the .fla then using a variable to assign them to a specific text field. I have managed to make this work in one case using Arial, and embedding the font (all Latin). If I don't embed, these characters are not showing up. However. in other instances, this same procedure does not seem to work. And I can't figure out what in my file could possibly affect this. Would it matter if some other, unrelated, text fields in the file were not set as embed? Would it matter if the textfields were set to htmlText or not? I have also tried using the unicode inside the variable (var name=\u00C2) but am not having better luck this way. So, I have a textfield called introText set as: Multiline, html-text, embed (all Latin), Arial, Bold Then a piece of code stating this.introText.htmlText =În prezent, industria de prelucrare a alimentelor se confruntă cu un număr din ce în ce mai mare de provocări contradictorii: fabricarea produselor de calitate în condiţii mai restrictive, rezolvarea problemelor legate de reglementările tot mai restrictive şi crearea de produse inovatoare pentru o bază de clienţi din ce în ce mai mare şi mai pretenţioasă. brbrŞurubul se strânge permanent. Trebuie să căutaţi economii acolo unde le puteţi face şi îmbunătăţiri acolo unde le puteţi găsi. Şi trebuie să vă alegeţi cu grijă oamenii cu care lucraţi. Rolul nostru în industria alimentară este vital. Prin îmbinarea cunoştinţelor noastre despre pompe şi despre sistemele de manevrare a fluidelor cu expertiza dvs. în industria alimentară pot rezulta soluţii de succes, economice şi avantajoase din punct de vedere competitiv.; Anyone's been through something similar and could shed some light? Thank you and sorry to bother you. /Fredrik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash Unicode issue (Latin extended Romanian chars)
Hi, I embed the font using a file like this: Tahoma.as package com.ourdomain.ui.fonts { import mx.core.FontAsset; [Embed(source=Tahoma.ttf, fontFamily=TahomaFont, mimeType=application/x-font-truetype, unicodeRange=U+0020-U+007E,U+00A1-U+017E)] public class Tahoma extends FontAsset { } } See the unicodeRange part (this works for countries like Poland). In some other file: Font.registerFont(Tahoma); Font.registerFont(TahomaBold); Font.registerFont(Comic); Font.registerFont(ComicBold); Then I use a font called TahomaFont. On the IDE even including the whole font did not seem to work for me, but when I specified characters like above it worked. Fredrik Jönsson wrote: I have run into problems with a flash project that needs to cover most european languages including Romanian, Slovenian, Slovakian etc. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Why is good to extend an Event Class
Why is it good to extend the Event Class in your application? I understand that you can create your own events with it that are specific to your app but does anyone have any good tutorials/articles on this? I am a visual learner and I don't get it fully just yet.. Meanwhile I'll keep searching.. Dwayne ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Kilobyte Size of AS Classes
When I use the Generate Size report in the publish settings, at the end of the file it says something like ActionScript BytesLocation -- 140568ActionScript 3.0 Classes Is there a way to break this up by class? I would love to get a list of each class and how large it is. Thanks! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 For loop proplem
This code should load a MovieClip from the library 5 times, place each on the stage and then load a different image into each one Instead it loads the 5 MovieClips from the library, places them on the stage and then only loads the image into the last (5th) MovieClip, whats going wrong? this code will not run as its stripped var itemList:XMLList = locationInfo.item; for (var i = 0; i itemList.length(); i++) // Loops through 5 times { _summaryElement[i] = loadLibrary(summaryContainer); // Load our MovieClip from the library loadImage(images/ + i + .jpg, _summaryElement[i].sumImg); // Should load image into _summaryElement[i].sumImg which is a blank placeholder movieclip } function loadImage(filename:String, mcName:MovieClip):void { _mcName = mcName; // Contains MovieClip object (object 1 through 5) var imageLoader:Loader = new Loader(); var imageURL:URLRequest = new URLRequest(filename); imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); } function imgLoadComplete(ev:Event):void { _mcName.addChild(ev.target.content); // This should add the loaded image into the placeholder movieclip for each of the 5 MovieClips } SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 For loop proplem
is your loadLibrary function is returning the same thing each time?? [EMAIL PROTECTED] wrote: This code should load a MovieClip from the library 5 times, place each on the stage and then load a different image into each one Instead it loads the 5 MovieClips from the library, places them on the stage and then only loads the image into the last (5th) MovieClip, whats going wrong? this code will not run as its stripped var itemList:XMLList = locationInfo.item; for (var i = 0; i itemList.length(); i++) // Loops through 5 times { _summaryElement[i] = loadLibrary(summaryContainer); // Load our MovieClip from the library loadImage(images/ + i + .jpg, _summaryElement[i].sumImg); // Should load image into _summaryElement[i].sumImg which is a blank placeholder movieclip } function loadImage(filename:String, mcName:MovieClip):void { _mcName = mcName; // Contains MovieClip object (object 1 through 5) var imageLoader:Loader = new Loader(); var imageURL:URLRequest = new URLRequest(filename); imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); } function imgLoadComplete(ev:Event):void { _mcName.addChild(ev.target.content); // This should add the loaded image into the placeholder movieclip for each of the 5 MovieClips } SJM ___ 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
RE: [Flashcoders] Why is good to extend an Event Class
There is an excellent thorough chapter on this in the Moock's AS3 book. Well worth reading. - MM Why is it good to extend the Event Class in your application? I understand that you can create your own events with it that are specific to your app but does anyone have any good tutorials/articles on this? I am a visual learner and I don't get it fully just yet.. Meanwhile I'll keep searching.. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Why is good to extend an Event Class
i used a scrollbar class from the kirupa forum that extended the event class to accept the amount (in percent) that the bar was scrolling by - this allowed both the scrollbar and the scrolling object to receive the percent by listening to the event On 6 May 2008, at 17:21, Dwayne Neckles wrote: Why is it good to extend the Event Class in your application? I understand that you can create your own events with it that are specific to your app but does anyone have any good tutorials/articles on this? I am a visual learner and I don't get it fully just yet.. Meanwhile I'll keep searching.. Dwayne ___ 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] Why is good to extend an Event Class
Hi, It's good to extend the Event Class because you can define your own event constants and also pass data around inside your event... The reason you do this is because you cannot rely on things in Flash don't happen in the same sequence all the time, so it's like asking someone to make something for you then tell you when they are finished so you can take the thing they have made and then do your bit. I guess an analogy would be like buying a prefab house from http://www.huf-haus.com, which is made in a factory and assembled in a very predictable way - almost synchronous. Compare this to the majority of house builders who might turn up and do a bit of work now and then, but you can't rely on them finishing on an exact date, (the one you book the plasterer for). This is pretty much asynchronous. You just have to wait for the builders to tell you they have finished, then ring the plasterer, etc. Web design is pretty much the same when some customers are involved - you can schedule all you want, but it goes out the window as soon as you ask the client to provide some content. :) Here is a quick example of an extended event that has constants and also defines a data variable of any type so I can pass information to listeners, below is an example of using it in context. It's not perfect - I am being a bit lazy by not typing my data and could probably improve stuff, but it's a start: //Simple class to extend event and pass score data around from AMF method call results package events { import flash.events.Event; public class ScoreBoardEvent extends Event { public var data:*; public static const SCORE_SERVER_ERR:String = Problem with the server; public static const SCORE_SUBMIT_OK:String = Score submitted ok; public static const SCORE_SUBMIT_ERR:String = Score submit error; public static const SCORE_LIST_OK:String = Scores listed ok; public static const SCORE_LIST_ERR:String = Scores listing error; public function ScoreBoardEvent(type:String, data:*) :void { super(type); this.data = data; } //You need to override the clone function to ensure the correct type gets passed around by the event mechanism. override public function clone():Event { return new ScoreBoardEvent(this.type, this.data); } } } /*My ScoreBoard class talks to the server and calls methods via remoting, this is the method that handles the result of one remote method call ScoreBoard extends Sprite because I needed it on the stage, you can always implement the EventDispatcher interface for objects that do not extend something that does : This is a snippet. */ private function submitResultHandler(result:*):void { try { if (result.count) { FlashConnect.trace(submitResultHandler + result.count); dispatchEvent(new ScoreBoardEvent(ScoreBoardEvent.SCORE_SUBMIT_OK, result));return; return; } } catch (err:Error) { //do nothing - we just get an exception if count does not exist... } FlashConnect.trace(submitResultHandler + result.error + , + result.faultString); dispatchEvent(new ScoreBoardEvent(ScoreBoardEvent.SCORE_SUBMIT_ERR, result.faultString)); } //Then in another class that uses ScoreBoard - ScoresScreen I listen for events from the ScoreBoard import events.ScoreBoardEvent; public class ScoresScreen extends Sprite { public function ScoresScreen() { var sc:ScoreBoard = ScoreBoard.getInstance(); //If the thing you want to listen to dispatches events, this is easy. sc.addEventListener(ScoreBoardEvent.SCORE_LIST_OK, makeScores); sc.addEventListener(ScoreBoardEvent.SCORE_LIST_ERR, showError); } private function makeScores(evt:ScoreBoardEvent):void { //... _currentOffset = evt.data.offset; _totalScores = evt.data.count; var rank:int = _currentOffset + 1; _rankText.htmlText = _namesText.htmlText = _scoresText.htmlText = ; var list:Object = evt.data.list; for (var i:String in list) { _rankText.htmlText += rank + \n; _namesText.htmlText += String(list[i][0]).toUpperCase() + \n; _scoresText.htmlText += list[i][1] + \n; trace(i + = + list[i][0] + , + list[i][1]); rank++; } } private function showError(evt:ScoreBoardEvent):void { trace(error + evt.data); //More stuff here... } } Dwayne Neckles wrote: Why is it good to extend the Event Class in your application? I understand that you can create your own events with it that are specific to your app but does anyone have any good tutorials/articles on
Re: [Flashcoders] Why is good to extend an Event Class
It's not really important to understand the why behind extending Event in AS3. The reasons become self-evident over time as you use it. There's no reason not to, so best to just do so. The only reason you wouldn't is if you spent considerable time to deeply understand the event system in AS3 (reading posts is only part of it - you would need to spend time running tests, poking around in the code, doing RD, basically) and somehow determined that extending Event was detrimental to a specific edge case that you were working on. I'd be hard pressed to figure out what that edge case would be, and I could come up with several arguments against the decision to not extend Event in that case. In other words, if you have to ask why you should use it, you should use it. ;) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] AS3 For loop proplem
Hi SJM, It looks like you're setting the persistent var, _mcName, to equal each _summaryElement[i].sumImg in turn as the loop progresses. That means that when the loop is finished, the value for _mcName will be a reference to _summaryElement[4].sumImg, the last clip being loaded. Since your loop undoubtedly runs faster than the loading process, what your imgLoadComplete handler is actually doing is this, _summaryElement[4].sumImg.addChild(ev.target.content). It wouldn't be surprising if you looked at the contents of _summaryElement[4].sumImg and found that all the images are added to its display list as each load completes. I would either get rid of the persistent var and find a way to use an ID number to link the loaded images and the containers, OR add this line to your loadImage method, _mcName.addChild(imageLoader);, and forget the event listener (at least for doing the addChild). Hth, Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 9:54 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] AS3 For loop proplem This code should load a MovieClip from the library 5 times, place each on the stage and then load a different image into each one Instead it loads the 5 MovieClips from the library, places them on the stage and then only loads the image into the last (5th) MovieClip, whats going wrong? this code will not run as its stripped var itemList:XMLList = locationInfo.item; for (var i = 0; i itemList.length(); i++) // Loops through 5 times { _summaryElement[i] = loadLibrary(summaryContainer); // Load our MovieClip from the library loadImage(images/ + i + .jpg, _summaryElement[i].sumImg); // Should load image into _summaryElement[i].sumImg which is a blank placeholder movieclip } function loadImage(filename:String, mcName:MovieClip):void { _mcName = mcName; // Contains MovieClip object (object 1 through 5) var imageLoader:Loader = new Loader(); var imageURL:URLRequest = new URLRequest(filename); imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); } function imgLoadComplete(ev:Event):void { _mcName.addChild(ev.target.content); // This should add the loaded image into the placeholder movieclip for each of the 5 MovieClips } 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] Flash Unicode issue (Latin extended Romanian chars)
Fredrik Jönsson wrote: I have run into problems with a flash project that needs to cover most european languages including Romanian, Slovenian, Slovakian etc. snip Anyone's been through something similar and could shed some light? Hi Fredrik, You mentioned that you are using the Arial font. While it is a Unicode font, it may not have all the glyphs you need for Eastern European languages. Unicode means that the characters it has are Unicode, but it doesn't mean it has all the glyphs--would you expect, for example, Inuit, Khmer, or Tibetan? I would recommend you try Arial Unicode, which is different from Arial. It has a much more complete character set, including languages such as Chinese and Japanese. You mentioned also that you were embedding the font. I would make sure the font is embedded in every text field--embedding it in the library, and then using the font from the library doesn't work, as I have found out the hard way. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash Unicode issue (Latin extended Romanian chars)
Thanks Kerry, Using Linotype FontExplorer to view detailed font information it seems Arial is missing the specific glyphs that are causing me problems(u+0218/19; u+21A/B). Strangely enough, I have managed to get the flash to display those characters in Arial!? I have noted that Hoefler Text contains these characters and will run some tests using this font. Now, the typeface I really want to use for the project is Franklin Gothic Demi. I have found a URW++ version that I understand contain these glyphs. This issue with all text fields having to specifically be instructed to embed - I don't seem to remember having this issue previously. Regards, Fredrik On 6 May 2008, at 20:09, Kerry Thompson wrote: Fredrik Jönsson wrote: I have run into problems with a flash project that needs to cover most european languages including Romanian, Slovenian, Slovakian etc. snip Anyone's been through something similar and could shed some light? Hi Fredrik, You mentioned that you are using the Arial font. While it is a Unicode font, it may not have all the glyphs you need for Eastern European languages. Unicode means that the characters it has are Unicode, but it doesn't mean it has all the glyphs--would you expect, for example, Inuit, Khmer, or Tibetan? I would recommend you try Arial Unicode, which is different from Arial. It has a much more complete character set, including languages such as Chinese and Japanese. You mentioned also that you were embedding the font. I would make sure the font is embedded in every text field--embedding it in the library, and then using the font from the library doesn't work, as I have found out the hard way. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash Unicode issue (Latin extended Romanian chars)
Thanks, this method was all new to me. How is embedding fonts like this viewed in terms of the type foundries' EULA? Does 'static embedding' and 'dynamic embedding' differ in terms of how the outlines are embedded? I have read that some type foundries make a difference between using their fonts in static text fields or dynamic text fields. /Fredrik On 6 May 2008, at 18:04, Abe Pazos wrote: Hi, I embed the font using a file like this: Tahoma.as package com.ourdomain.ui.fonts { import mx.core.FontAsset; [Embed(source=Tahoma.ttf, fontFamily=TahomaFont, mimeType=application/x-font-truetype, unicodeRange=U+0020-U +007E,U+00A1-U+017E)] public class Tahoma extends FontAsset { } } See the unicodeRange part (this works for countries like Poland). In some other file: Font.registerFont(Tahoma); Font.registerFont(TahomaBold); Font.registerFont(Comic); Font.registerFont(ComicBold); Then I use a font called TahomaFont. On the IDE even including the whole font did not seem to work for me, but when I specified characters like above it worked. Fredrik Jönsson wrote: I have run into problems with a flash project that needs to cover most european languages including Romanian, Slovenian, Slovakian etc. ___ 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 For loop proplem
Hi SJM I am trying to reproduce it for you. Whats in : locationInfo.item ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Flash Unicode issue (Latin extended Romanian chars)
Fredrik Jönsson wrote: Using Linotype FontExplorer to view detailed font information it seems Arial is missing the specific glyphs that are causing me problems(u+0218/19; u+21A/B). Strangely enough, I have managed to get the flash to display those characters in Arial!? I wonder if there are different versions of Arial for different languages, or even locales. I haven't explored it like you have, but I could see a version of Arial for Baltic countries that has different glyphs from one for Western Europe. Pure speculation, but that might be what you're seeing. This issue with all text fields having to specifically be instructed to embed - I don't seem to remember having this issue previously. Well, I may be doing something wrong (if I am, I hope somebody points it out). I'm doing a music program, and I've embedded three music fonts in the library. I have a rather lengthy movie clip with different note and rest values--my strategy is to put instances of this clip on-stage, then just gotoAndStop(dq) (for dotted quarter). Early on, I found that embedding the font in the library, then setting the font in the text fields to that embedded music font, didn't work. I got regular letters, probably in the system default font. I embedded the font in the text field (a static text field), and it displays the music notes I want. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders