Jump to content
Search Community

stevenp last won the day on December 27 2013

stevenp had the most liked content!

stevenp

Members
  • Posts

    57
  • Joined

  • Last visited

  • Days Won

    1

stevenp last won the day on December 27 2013

stevenp had the most liked content!

stevenp's Achievements

7

Reputation

  1. Thank you in advance. I have a SWF that loads files and plays them. I have another SWF in the same directory as the first that will not load the first SWF. It looks like it loads, but it does not play. container.swf // looks liek ti is tryign to load swf_to_load.swf swf_to_load.swf // loads it's assets just fine assets/1.file assets/2.file assets/3.file swf_to_load.swf loads and plays perfectly. container.swf does not. swf_to_load.swf was not published with "protect from import" checked. This is the code to load the fully function, fully self contained swf_to_load.swf file: var loader:SWFLoader = new SWFLoader("swf_to_load.swf", {name:"mainSWF", container:this, autoPlay:true}); loader.load(); It looks like it loads, but it doesn't play. I see the visual assets. So, seeing no error, I add an "onComplete" handler to trace out "we are complete", and the trace just keeps looping. Looping to the poitn of crashing windows. So I try loading the errorHandler as exampled on the documentation, but it does nto print otu any errors. This is maddening. The files are too big to load. thanks in advance. Any help is appreciated.
  2. Thanks Carl. I appreciate you telling me I'm all over the road. Believe it or not, that helps. To answer one question: I wanted to build a player where a user could play an array of files, or a single file. I'll let this job go and try to start with simple "Hello World" stuff.
  3. Well, using the "status" I'm able to determine that the loader is unloaded ... but does that also mean the assets are unloaded? And if unloaded, shouldn't the function that loads and plays the assets actually work on the second iteration? I am not able to upload a file because the smallest I can make it is 7MB. So, I guess I'll regurgitate the code here: import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import com.greensock.loading.*; import com.greensock.loading.display.*; import com.greensock.events.LoaderEvent; import com.greensock.events.*; import flash.events.MouseEvent; LoaderMax.activate([MP3Loader]); ////////////////////////////////////////////////////////////////////// var playInteger:int = 0; ////////////////////////////////////////////////////////////////////// var queue:LoaderMax; var sound:MP3Loader; // declare outside of any function var positionOfSong:int; var preloadCount:uint = 0; var curSoundIndex:int = -1; var mp3Array:Array = ["1.mp3", "2.mp3", "3.mp3"]; /////////////////////////////////////////////////////////////////////// // listeners mc_00.addEventListener(MouseEvent.CLICK, functionPlay00); mc_01.addEventListener(MouseEvent.CLICK, functionPlay01); mc_02.addEventListener(MouseEvent.CLICK, functionPlay02); mc_03.addEventListener(MouseEvent.CLICK, functionPlay03); btn_play2.addEventListener(MouseEvent.CLICK, functionPlayButton); btn_play2.addEventListener(MouseEvent.CLICK, functionResumeSongButton); btn_pause2.addEventListener(MouseEvent.CLICK, functionPauseButton); btn_next2.addEventListener(MouseEvent.CLICK, functionNextSongButton); btn_previous2.addEventListener(MouseEvent.CLICK, functionPreviousSongButton); /////////////////////////////////////////////////////////////////////// // functions function initPreload():void { queue = new LoaderMax({name:"mainQueue", onChildComplete:childCompleteHandler, maxConnections:1}); for (var i:int = 0; i < mp3Array.length; i++) { queue.append(new MP3Loader(mp3Array[i], {name:"mp3"+i, autoPlay:false})); } queue.load(); } // make sure one song is loaded before playing back function childCompleteHandler(event:LoaderEvent):void { preloadCount++; if (preloadCount == 1) { playAudioFile(0); } } // original 'play' function function playAudioFile(index:uint):void { if (curSoundIndex != -1) { var old:MP3Loader = LoaderMax.getLoader(mp3Array[curSoundIndex]) as MP3Loader; old.removeEventListener(MP3Loader.SOUND_COMPLETE, soundCompleteHandler); TweenLite.to(old, 1, {volume:0, onComplete:old.pauseSound}); } curSoundIndex = index; sound = LoaderMax.getLoader(mp3Array[index]) as MP3Loader; sound.addEventListener(MP3Loader.SOUND_COMPLETE, soundCompleteHandler); sound.gotoSoundTime(0, true); TweenLite.to(sound, 1, {volume:1}); trace(mp3Array[curSoundIndex]); // the current playing mp3 file var url:String = mp3Array[curSoundIndex]; var request:URLRequest = new URLRequest(url); var mp3:Sound = new Sound(request); mp3.addEventListener(Event.ID3, id3Handler) } function soundCompleteHandler(event:LoaderEvent):void { var nextIndex:int = curSoundIndex + 1; trace(nextIndex); if (nextIndex >= mp3Array.length) { nextIndex = 0; } playAudioFile(nextIndex); } // button functions function functionPlay00(e:MouseEvent):void{ flash.media.SoundMixer.stopAll(); var curSoundIndex:int = -1; playInteger = playInteger + 1; trace("Play All"); trace("Button click number " + playInteger); initPreload(); } function functionPlay01(e:MouseEvent):void{ flash.media.SoundMixer.stopAll(); var sound:MP3Loader = new MP3Loader("1.mp3", {name:"audio", autoPlay:true, estimatedBytes:9500}); var url:String = "1.mp3"; var request:URLRequest = new URLRequest(url); var mp3:Sound = new Sound(request); mp3.addEventListener(Event.ID3, id3Handler) sound.load(); } function functionPlay02(e:MouseEvent):void{ flash.media.SoundMixer.stopAll(); var sound:MP3Loader = new MP3Loader("2.mp3", {name:"audio", autoPlay:true, estimatedBytes:9500}); var url:String = "2.mp3"; var request:URLRequest = new URLRequest(url); var mp3:Sound = new Sound(request); mp3.addEventListener(Event.ID3, id3Handler) sound.load(); } function functionPlay03(e:MouseEvent):void{ flash.media.SoundMixer.stopAll(); var sound:MP3Loader = new MP3Loader("3.mp3", {name:"audio", autoPlay:true, estimatedBytes:9500}); var url:String = "3.mp3"; var request:URLRequest = new URLRequest(url); var mp3:Sound = new Sound(request); mp3.addEventListener(Event.ID3, id3Handler) sound.load(); } ////////////////////////////////////////////////////////////////////////////// // transport functions function functionPlayButton(e:MouseEvent):void{ trace("play button"); } function functionNextSongButton(e:MouseEvent):void{ trace("next button"); var nextIndex:int = curSoundIndex + 1; if (nextIndex >= mp3Array.length) { nextIndex = 0; } playAudioFile(nextIndex); } function functionPreviousSongButton(e:MouseEvent):void{ trace("previous button"); trace("Current Sound index: " + curSoundIndex); var nextIndex:int = curSoundIndex - 1; if (nextIndex <= -1) { nextIndex = mp3Array.length - 1; } playAudioFile(nextIndex); } function functionPauseButton(e:MouseEvent):void{ trace("pause button"); positionOfSong = sound.soundTime; trace("positionOfSong at pause time: " + sound.soundTime); sound.pauseSound(); } function functionResumeSongButton(e:MouseEvent):void{ trace("resume button"); trace("positionOfSong at resume time: " + sound.soundTime); sound.gotoSoundTime(positionOfSong, true); } function functionStopButton(e:MouseEvent):void{ trace("stop button"); } //////////////////////////////////////////////////// // ID3 handling function id3Handler(event:Event):void { var song:Sound = Sound(event.target); var songInfo:ID3Info = ID3Info(song.id3); dyn_txt.htmlText="track: " + songInfo.songName + "<br />" + songInfo.comment; } ////////////////////////////////////////////////////
  4. I tried LoaderMax.getLoader("mainQueue").dispose(); and while I didn't get an error, it didn't solve my problem (nor do I know if "unload" is what I want to do, for that matter). Does dispose also remove the loaded assets? Is there a way to list loaded assets? Using CS4 I can't see an obvious way to enumerate loaded assets ("List objects" and "List variables" does not). Thanks, Steve
  5. Thanks Carl. 1) In my above code, what is the name of my loader? 2) Once I've identified that name, I don't get the way to flush it. 3) What does my line queue.load(true); do? I assume from my code above the name is "mainQueue" (makes sense to me): LoaderMax.getLoader("mainQueue"); If that is the correct name ... what next? In another function ... do I do: LoaderMax.getLoader("mainQueue").dispose() ? I'm sure it is obvious ... but not to me. I don't come from an object oriented background, I come from a design background. It's like ... I need documentation to understand the documentation, and that's embarrassing to admit. The goal is I want to destroy the loader and it's content in the hopes that I can then play the queue a second time (behaves just fine the first time through, but will not play a second time). Thanks, Steve
  6. Let me refine, and ask "How I would reference the loader and content from a seperate function or listener?"; one that is not related to onComplete or onError, for example.
  7. Thank you in advance for reading. I want to get my head around LoaderMax, and to that end I want to manually destroy a loader and the content it loads. This loads an array of MP3s and plays them: var queue:LoaderMax; var sound:MP3Loader; var positionOfSong:int; var preloadCount:uint = 0; var curSoundIndex:int = -1; var mp3Array:Array = ["01.mp3", "02.mp3", "03.mp3" ]; initPreload(); function initPreload():void { queue = new LoaderMax({name:"mainQueue", onChildComplete:childCompleteHandler, onError:errorHandler, noCache:true, maxConnections:1, dispose:true}); for (var i:int = 0; i < mp3Array.length; i++) { queue.append(new MP3Loader(mp3Array[i], {name:"mp3"+i, autoPlay:false})); } queue.load(true); } function errorHandler(event:LoaderEvent):void { trace("Error occured with " + event.target + ":" + event.text); } // make sure one song is loaded before playing back function childCompleteHandler(event:LoaderEvent):void { preloadCount++; if (preloadCount == 1) { playAudioFile(0); } } How do I reference and remove the loaders and the loaded content? thanks, Steve
  8. Greetings and thanks in advance for reading, I've built an MP3 player that *should* load an array and play it while displaying ID3 info. The array play uses transport buttons that perform play, pause, next, and previous functions flawlessly (not the individual file plays--they just play through) Also, will play an MP3 individually and display ID3 info. It works great great. Just fantastic. Where it fails is probably a logic failure on my part: Once the "Play All" buttons starts playing the array, if the user circumvents the list in order to play an individual file, it does so just fine. However, upon clicking the "Play All" button again, the list loads but does not play. I know it loads because I can press the "play button and sure enough, it starts up, but only at the beginning of the last song played on the list. So, what am I after? I want the list to start again from the top. I have no idea apparently how to unload the array, nor if even is that what I want to do. I can paste code, but I guess I'm looking for a general logic check first, and thanks again for reading. Steve
  9. During publishing of the SWF (or one of the SWFs imported into your SWF), if you have "include hidden layers" checked, then even hidden layers are exported.This could be what is displayed for you. This vexed me for weeks until I figured that out. in CS4: Publish settings --> Flash tab-->SWF section
  10. Thank you Carl. That was exactly it. Now, I will look into how those two statements differ.
  11. Thanks Carl. I used onError to see if anything was returned, and there were no errors returned (I left this debugging code in the FLA). I tried to attach a CS4 file that includes only the source FLA, and the SWF that is referenced in the AS in frame 2, but wasn't able to do so. "no file selected" after three minutes of trying to upload. No clue what that means as I did, of course, select a file to upload then clicked "upload". So I tried the advanced method to attach ... and my 32 MB file is too large? Okay ... http://giantsquid.us/flash.zip <-- a friend let me park it here. I tried MonsterDebugger, but couldn't link to the SWC file. Their instructions are for CS5, and I have CS4 ... but the directions for linking via library were not clear to me, so I did not try that method to debug. Thank you for pointing me to that option.
  12. Greetings and thank you in advance for reading this, I built a two frame animation that works splendidly in the CS4 authoring environment (no error nor any output other than the "trace" returns), and when the SWF file is opened with a browser, but not when the authored HTML that references the SWF is opened by the browser. The problem is that once the animation of frame 1 completes, it goes back to frame 1's default set up. It's a two-frame because logically that made sense to me. I wanted to use SWFloader and noCache, and this was the way it laid itself out to me when I developed it. I'm familiar with "gotoAndPlay" using frame numbers/names in AS3, so I built an animation that runs when a button is clicked. Upon completion of the animation, we go to frame 2 and load the external SWF. Is there something in my code that might be killing the browser? Frame 1's AS3: stop(); import com.greensock.loading.*; import com.greensock.loading.display.*; import com.greensock.*; import com.greensock.events.LoaderEvent; import com.greensock.events.TweenEvent; var var_gotoAndPlay_timer:Number = 2; mc_gotoAndPlay.addEventListener(MouseEvent.CLICK, gotoAndPlayFuntion); function gotoAndPlayFuntion(e:MouseEvent):void{ trace("call the gotoAndPlayFunction function"); var tl_gotoAndPlay:TimelineMax = new TimelineMax({delay:1, onComplete:tweenOnComplete}); tl_gotoAndPlay.insert(TweenMax.to(mc_gotoAndPlay, var_gotoAndPlay_timer, {alpha:0, y:"-50"}) ); tl_gotoAndPlay.insert(TweenMax.to(mc_overlay, var_gotoAndPlay_timer, {alpha:0}) ); tl_gotoAndPlay.insert(TweenMax.from(mc_loadingTXT, var_gotoAndPlay_timer, {delay:1, alpha:0, y:"50"}) ); } //function tweenOnComplete(e:TweenEvent):void { function tweenOnComplete() { trace("call the tweenOnComplete function"); gotoAndPlay(2); } Frame 2's AS3: stop(); trace("we are on frame 2"); var video:SWFLoader = new SWFLoader("video-cache_buster-dev-03.swf", {container:mc_holder, noCache:true, width:480, height:320, onComplete:setupButtons}); video.load(); function playSWF(e:MouseEvent):void{ video.rawContent.play(); } function pauseSWF(e:MouseEvent):void{ video.rawContent.stop(); } function setupButtons(e:LoaderEvent){ play_btn.visible = true; pause_btn.visible = true; play_btn.addEventListener(MouseEvent.CLICK, playSWF); pause_btn.addEventListener(MouseEvent.CLICK, pauseSWF); } Most of the code I've used was gleaned from help other people got on these forums, so a "thank you" to the people who helped them out because you've helped me, too. Best regards, Steve
  13. Carl, thank you SO much for the above code!! You and Jack are helping me to learn to fish. Happy New Year, Steve
×
×
  • Create New...