Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

stevenp last won the day on December 27 2013

stevenp had the most liked content!


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by stevenp

  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
  14. There is no FLA file in that zip file. Not that I could help you, but just a "heads up".
  15. Bingo!!! The syntax in this kind of looks odd: tl.call(changeText, ["phase 1"]) .to(mc, 1, {x:400}) .call(changeText, ["phase 2"]) .to(mc, 1, {y:200}) .call(changeText, ["phase 3"]) .to(mc, 1, {x:0}) .call(changeText, ["phase 4"]) No commas? No semi-colons? But, it does work. And, I was able to still insert labels using that. Wowsers!!! Thank you _very_ much. I'm going to dig into ".call". Best regards, Steve
  16. Wow! Thank you Carl. That's some stuff to wrap my brain around. I'll get right on that. Thank you!!!!
  17. Greetings one and all. Hopefully Christmas brought your family together. Thank you in advance. I have a need to update a dynamic text box when a new label is reached. The animation is a sequence of lines drawn, points reached and then the point animated, and an image faded. This all works quite nicely - Jack, your packages are _amazing_!! What I would like to do is as best I can explain: as each label is reached, a dynamic text box is updated with new text. On each new label created, would an "onStart" be apropos? And ... how would I populate the box? I've built dynamic text boxes that are stacked upon each other and when a new label reached, the old text box is alpha-faded out & the new is alpha-faded in. That seems wasteful and is certainly inelegant. My SWF is large, at 51 labels and with unrelated animation and content, but I've trimmed it down to 4 labels in the code below. Any help will be appreciated. import com.greensock.*; import com.greensock.plugins.*; import com.greensock.easing.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; mc_ball.x = P1.x; mc_ball.y = P1.y; mc_map_uk.alpha = 0; var line:Shape = new Shape(); addChild(line); // timing variables ///////////////////////////////////////// var timer_tweek:Number = .8; var staticTimer_var:Number = 4; var image_fade_var:Number = .01; var point_bounce_var:Number = 3; ///////////////////////////////////////////////////////////// drawRoute(); function drawRoute () { var tl_drawRoute:TimelineMax = new TimelineMax(); ///////////////////////////////////////////////////////////// // add each line tween and label the insert point // draw using same time for each tween: tl_drawRoute.to(mc_ball, staticTimer_var, {x:P2.x, y:P2.y, ease:Linear.easeNone, onUpdate:drawLine}, "point_1"); tl_drawRoute.to(mc_ball, staticTimer_var, {x:P3.x, y:P3.y, ease:Linear.easeNone, onUpdate:drawLine}, "point_2"); tl_drawRoute.to(mc_ball, staticTimer_var, {x:P4.x, y:P4.y, ease:Linear.easeNone, onUpdate:drawLine}, "point_3"); tl_drawRoute.to(mc_ball, staticTimer_var, {x:P5.x, y:P5.y, ease:Linear.easeNone, onUpdate:drawLine}, "point_4"); ///////////////////////////////////////////////////////////// line.graphics.clear(); line.graphics.lineStyle(3, 0xFF0000); line.graphics.moveTo(mc_ball.x, mc_ball.y); ///////////////////////////////////////////////////////////// // insert dot tweens at the appropriate label // each tween has the same duration and will start when it's respective line tween starts tl_drawRoute.insert( TweenMax.fromTo(P1, point_bounce_var, {scaleX:0, scaleY:0}, {scaleX:1, scaleY:1, ease:Elastic.easeOut}), "point_1"); tl_drawRoute.insert( TweenMax.fromTo(P2, point_bounce_var, {scaleX:0, scaleY:0}, {scaleX:1, scaleY:1, ease:Elastic.easeOut}), "point_2"); tl_drawRoute.insert( TweenMax.fromTo(P3, point_bounce_var, {scaleX:0, scaleY:0}, {scaleX:1, scaleY:1, ease:Elastic.easeOut}), "point_3"); tl_drawRoute.insert( TweenMax.fromTo(P4, point_bounce_var, {scaleX:0, scaleY:0}, {scaleX:1, scaleY:1, ease:Elastic.easeOut}), "point_4"); ///////////////////////////////////////////////////////////// // image fades called at apporpriate label tl_drawRoute.insert( TweenMax.fromTo(I1, image_fade_var, {alpha:0}, {alpha:1, ease:Elastic.easeOut}), "point_1"); tl_drawRoute.insert( TweenMax.fromTo(I2, image_fade_var, {alpha:0}, {alpha:1, ease:Elastic.easeOut}), "point_2"); tl_drawRoute.insert( TweenMax.fromTo(I3, image_fade_var, {alpha:0}, {alpha:1, ease:Elastic.easeOut}), "point_3"); tl_drawRoute.insert( TweenMax.fromTo(I4, image_fade_var, {alpha:0}, {alpha:1, ease:Elastic.easeOut}), "point_4"); } function drawLine() { // trace("drawLine called"); } function testComplete () { // trace("test complete"); } Best, Steve
  18. By the way, I came back this morning to report that I am stupefied by the versatility of this package. How amazing it is!
  19. Ah! That makes sense. Thank you Rodrigo.
  20. Maybe I'm going crazy, but the tween when it works sends the element to the right. Thanks again, Steve
  21. Thank you Carl. That does in fact work. Clearly, I have a lot to grep. It would probably help if I was more thorough in my reading and comprehension. I do appreciate the time you've both taken to help me. Much thanks. May I sum up my understanding? Set the timeline variable outside of a function (scope), and in a paused state. Set up the timeline Set up each button with the appropriate function Best regards, Steve
  22. Thank you, Rodrigo, but I tried it and this doesn't do anything: var tl4 = new TimelineLite({paused:true}); $("#play").click(function() { tl4.to(logo4, 2, {css:{borderBottomColor:'#90E500', left:'542px', backgroundColor:'black', color:'white'}, delay:0, paused:true}) ); tl4.play(); }); I changed tl to tl4 for consistency. I'm going to leave well enough alone and chalk it up to user inexperience on my part. Thank you for trying to help me.
  23. Thanks Carl. I tried forking with that online deal, and it was a study in irritation. I'll just take my lumps and a loss for now. Thanks to both of you for trying to help me.