Jump to content
Search Community

Search the Community

Showing results for tags 'loadermax'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

  1. The first parameter of the various loaders (ImageLoader, XMLLoader, SWFLoader, MP3Loader, etc.) accepts either a simple String URL or a URLRequest. So if you want to pass data to the server, simply construct a URLRequest accordingly, like: var request:URLRequest = new URLRequest("http://www.yourDomain.com/whatever.php"); var data:URLVariables = new URLVariables(); data.exampleSessionId = new Date().getTime(); data.exampleUserLabel = "label1"; request.data = data; request.method = URLRequestMethod.POST; var loader:ImageLoader = new ImageLoader(request, {name:"image1"});
  2. LoaderMax is included in the main AS3 GreenSock download zip.
  3. Hi all... Based on one of your Great Codes I developed this one : It is all about 4 SWF files that will be load one after another then it stores last swf you ran when you close it ( when you exit each one it will be load next time exactly the same SWF you've exited). for example if you close swf number 3 , next time you start the main swf you will start from SWF number 3... But there is a big problem here ... Each of my SFWs are about 10 to 16 Mb (I didn't create them with flash) and unfortunately your code seem to load all of them at once ... then play them in sequence ... I have to load more than 100 SWF files and it will definitely cause RAM issue ... Each one cost me 10-16MB... I'm not a programmer but I'm thinking why showing multiple SWF files and remembering where you left is that hard in 2018 ??? ... Please Help me find a way to load swfs one after another and save last status of it ... You're My Last Hope Carl ... Thanks import flash.events.FullScreenEvent; import flash.display.StageScaleMode; stage.scaleMode = StageScaleMode.SHOW_ALL; stage.displayState = StageDisplayState.FULL_SCREEN; import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import flash.net.SharedObject; import flash.events.MouseEvent; var mySO:SharedObject = SharedObject.getLocal("edfiujy6grwfh"); var reza:Number = -1; var loaderIndex:Number = -1; loaderIndex = mySO.data.my_vis; if (!mySO.data.my_vis) { loaderIndex = -1; } if (mySO.data.my_vis == 1) { loaderIndex = 0; } if (mySO.data.my_vis == 2) { loaderIndex = 1; } if (mySO.data.my_vis == 3) { loaderIndex = 2; } if (mySO.data.my_vis == 4) { loaderIndex = 3; } progress_mc.scaleX = 0; var currentLoader:SWFLoader; var swfs:LoaderMax = new LoaderMax({onComplete:completeHandler,onProgress:progressHandler,onChildComplete:childCompleteHandler}); swfs.append(new SWFLoader("part1.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part2.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part3.swf", {container:this.stage, autoPlay:false})); swfs.append(new SWFLoader("part4.swf", {container:this.stage, autoPlay:false})); function progressHandler(e:LoaderEvent):void { progress_mc.scaleX = e.target.progress; } function childCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); e.target.content.visible = false; } function completeHandler(e:LoaderEvent):void { trace("all swfs loaded"); progress_mc.visible = false; initCurrentLoader(); addEventListener(Event.ENTER_FRAME, trackSWFPlayback); } function initCurrentLoader() { loaderIndex++; trace(loaderIndex); reza = loaderIndex trace(reza); mySO.data.my_vis = loaderIndex; mySO.flush (); if (loaderIndex == swfs.numChildren) { //reset back to 0 if the last swf has already played //loaderIndex = 0; //can't show stuff that was unloaded so lets stop mySO.clear(); loaderIndex = -1 swfs.load(); trace("all done everyone gone"); removeEventListener(Event.ENTER_FRAME, trackSWFPlayback); } else { //dynamically reference current loader based on value of loaderIndex currentLoader = swfs.getChildAt(loaderIndex); //make the content of the current loader visible currentLoader.content.visible = true; //fade it in TweenLite.from(currentLoader.content, 0.1, {alpha:1}); //tell the current loader's swf to to play currentLoader.rawContent.gotoAndPlay(1); } } function trackSWFPlayback(e:Event):void { //trace(currentLoader.rawContent.currentFrame); //detect if the loaded swf is on the last frame if (currentLoader.rawContent.currentFrame == currentLoader.rawContent.totalFrames) { trace("swf done"); //hide and stop current swf currentLoader.content.visible = false; currentLoader.rawContent.stop(); //unload the swf that just played currentLoader.unload(); //set up and play the next swf initCurrentLoader(); } } this.addEventListener(Event.ENTER_FRAME, loadSWFs) function loadSWFs(e:Event):void{ load_btn.visible = false; swfs.load(); this.removeEventListener(Event.ENTER_FRAME, loadSWFs) } /* Click to Hide an Object Clicking on the specified symbol instance hides it. Instructions: 1. Use this code for objects that are currently visible. */
  4. Since I've updated my AIR runtime to 27.0.0.124, I'm experiencing a crash in any project that uses ImageLoader / LoaderMax to load images from the local file system. This is a brand new issue that has just started today and is consistent with all my previous projects. The code is: var queue:LoaderMax = new LoaderMax( { onComplete:onBitmapsLoaded, onError:onBitmapsError } ); for (var i:int = 0; i < _imagesToLoad.length; i++) { queue.append(new ImageLoader(_imagesToLoad[i].path, {name:_imagesToLoad[i].id})); } queue.load(); At the point of calling LoaderMax to load, the application crashes with the following report: Log Name: Application Source: Application Error Date: 27/09/2017 14:30:50 Event ID: 1000 Task Category: (100) Level: Error Keywords: Classic User: N/A Computer: DESKTOP-L18EOIN Description: Faulting application name: adl.exe, version: 26.0.0.118, time stamp: 0x592be5a1 Faulting module name: SS2DevProps.dll, version: 0.0.0.0, time stamp: 0x58873503 Exception code: 0xc0000005 Fault offset: 0x00009522 Faulting process ID: 0x2534 Faulting application start time: 0x01d33794d41287f9 Faulting application path: C:\Users\ben\AppData\Local\FlashDevelop\Apps\flexairsdk\4.6.0+26.0.0\bin\adl.exe Faulting module path: C:\Program Files\ASUSTeK COMPUTER INC\SS2\UserInterface\SS2DevProps.dll Report ID: c4b45f2f-183b-470f-95df-1a1a28134578 Faulting package full name: Faulting package-relative application ID: Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Application Error" /> <EventID Qualifiers="0">1000</EventID> <Level>2</Level> <Task>100</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2017-09-27T13:30:50.246338200Z" /> <EventRecordID>6764</EventRecordID> <Channel>Application</Channel> <Computer>DESKTOP-L18EOIN</Computer> <Security /> </System> <EventData> <Data>adl.exe</Data> <Data>26.0.0.118</Data> <Data>592be5a1</Data> <Data>SS2DevProps.dll</Data> <Data>0.0.0.0</Data> <Data>58873503</Data> <Data>c0000005</Data> <Data>00009522</Data> <Data>2534</Data> <Data>01d33794d41287f9</Data> <Data>C:\Users\ben\AppData\Local\FlashDevelop\Apps\flexairsdk\4.6.0+26.0.0\bin\adl.exe</Data> <Data>C:\Program Files\ASUSTeK COMPUTER INC\SS2\UserInterface\SS2DevProps.dll</Data> <Data>c4b45f2f-183b-470f-95df-1a1a28134578</Data> <Data> </Data> <Data> </Data> </EventData> </Event> Is this just my local system? I've redownloaded and replaced the .SWC component but the problem remains. Thanks, Ben
  5. Hello Carl and eveybody ... I found this project you uploaded named loadSWFsPlaySequence dot zip ... but unfortunately I faced a big problem : problem 1 : as I want to load huge and multiple swfs one after another I should be aware of memory that loaded swfs take ,so I tried to unload last swf when new swf is loading but each time I failed ... problem 2 : how can I fade in each swf that is loading using loadeMax ? please somebody tell me am I such stupid or it's hard to ... can you help ? thanks a lot ... link to that file : http://greensock.com/forums/index.php?app=core&module=attach&section=attach&attach_id=2074
  6. I am developing a Flex application which will allow a user to drag an HSlider left and right to display a series of images (like a flicker book). I am new to LoaderMax but it appears to be just what I need for efficiently loading the images ready for the user to interact with. If I am correct in my understanding I create a new LoaderMax object, define eventListeners to monitor the cycle of events and then I can append an ImageLoader for each image I want to load. I can then call the .load method to load the images. What I can't seem to grasp is how I can display the resulting loaded images and change them as the HSlider is moved. Can I define a Spark Image in my mxml View and bind its source to a variable in my presenter which changes as the HSlider is moved? I see there is a FlexContentDisplay class but I can't figure out how to place this in my View. Thanks
  7. Hello. I've been searching for an answer to this problem but to no avail. I'm simply testing the LoaderMax and I haven't customized anything to fit my stage. I only want to load a video (flv file) and see that it plays. 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; ... var video:VideoLoader = new VideoLoader("flv/loader.flv", {name:"myVideo", container:this, width:400, height:300, scaleMode:"proportionalInside", bgColor:0x000000, autoPlay:false, volume:0, requireWithRoot:this.root, estimatedBytes:75000}); var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler}); queue.append( video ); queue.load(); I've imported all of these and used the code correctly as far as I know how to but it gives me the error Error on VideoLoader 'myVideo' (flv/loader.flv): NetStream.Play.StreamNotFound Edit: I have not put the flv in my Library, nor is it on the stage. Is that needed? I would like to load it from a location within the directory: flv/loader.flv
  8. Greetings all, I've run into a problem with loadermax videoloader. I have the video loading and can play it with no problem. My problem is that I cannot get it to play using a play button that is used in my project. In the queueCompleteHandler below, I add a listener which works: videoContent.addEventListener(MouseEvent.CLICK, _togglePause,false, 0, true); This is clicking on the video itself to get it to play. What I would like to do is have a mc which overlays the video take over the play actions: This fails miserably: firstPlay.addEventListener(MouseEvent.CLICK, firstVidPlay); My code: function _queueCompleteHandler(event:LoaderEvent):void { var video:VideoLoader = LoaderMax.getLoader("vid/u1a2p3.mp4"); trace("duration:", video.duration); var videoContent:ContentDisplay = LoaderMax.getContent("vid/u1a2p3.mp4"); videoContent.x = vidBG.x; videoContent.y = vidBG.y; videoContent.width = 512; videoContent.height = 288; videoContent.scaleMode = "proportionalInside"; addChild(videoContent); addChild(firstPlay); videoContent.addEventListener(MouseEvent.CLICK, _togglePause,false, 0, true); firstPlay.addEventListener(MouseEvent.CLICK, firstVidPlay); } WORKS: function _togglePause(event:MouseEvent):void { var video:VideoLoader = VideoLoader(event.target.loader); video.videoPaused = ! video.videoPaused; video.playVideo(); } DOES NOT WORK: function firstVidPlay(event:MouseEvent):void { var video:VideoLoader = VideoLoader(event.target.loader); video.videoPaused = ! video.videoPaused; video.playVideo(); firstPlay.visible = false; } Any help will be appreciated. If this can be solved, then my scrubber woes should be solved as well. Cheers!
  9. Hi guys, I am new to AS3 and am trying to figure out how I can determine which asset should be loading on top or below the current asset. I would prefer to just have 2 physical mcs on the stage that I could load the assets into and layer them based on my preference. Currently I have the following code and all I would like to do is make the container the assets are being loaded into a real movieclip on the timeline rather than a dynamically created one. How would I change the code in order to accomplish this? Goal: To have img2.jpg loaded below img0.png Thanks! import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; //create a LoaderMax named "mainQueue" and set up onProgress, onComplete and onError listeners var queue:LoaderMax = new LoaderMax({name:"mainQueue",onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler}); //append several loaders queue.append( new ImageLoader("imgs/img1.jpg", {name:"photo1", estimatedBytes:22000, container:this, alpha:1, x:0, y:109}) ); queue.append( new ImageLoader("imgs/img0.png", {name:"img0", estimatedBytes:36000, container:this, alpha:1, x:55, y:114}) ); queue.append( new ImageLoader("imgs/img2.jpg", {name:"photo2", estimatedBytes:22000, container:this, alpha:0, x:500, y:109})); //start loading queue.load(); function progressHandler(event:LoaderEvent):void { trace("progress: " + event.target.progress); } function completeHandler(event:LoaderEvent):void{ var image2:ContentDisplay = LoaderMax.getContent("photo2"); TweenLite.to(image2, .5, {alpha:1, x:0, delay:3}); trace(event.target + " is complete!"); }
  10. So I have a swf file with an embedded font I made in Flash Pro. What I'm trying to do is dynamically load this swf into my project using LoaderMax and SWFLoader, then register that font so it can be used later. The swf is downloaded and stored locally beforehand. It seems to be loading the swf fine, the problem is when I try to register the font, it throws an error saying the class from the swf is invalid. Code to load the SWF: FontLoader = new LoaderMax( { onComplete: fontsLoaded, skipFailed: true } ); for(var i:int=0; i < mainXML.Fonts.Font.length(); i++) { name = mainXML.Fonts.Font[i].FontFamily.text(); fileName = File.applicationStorageDirectory.resolvePath("UpsellAssets/" + name + ".swf").nativePath; FontLoader.append( new SWFLoader( fileName, { name: name } ) ); } FontLoader.load(true); onComplete function: private function fontsLoaded(e:LoaderEvent):void { var loader:SWFLoader = FontLoader.getLoader("Myriad"); _fontClass = loader.getClass("Myriad") Font.registerFont(_fontClass);//throws error here...The value specified for argument font is invalid. } _fontClass seems to load properly, but I cant seem to access the font. Any insight on what might be wrong would be greatly appreciated. Thanks ^.^
  11. Hello guys, This is my first time using LoaderMax to load assets as I usually use the Starling asset manager however I am working on a standard flash application now and have had good experiences with TweenMax and TweenLite so thank you for providing these awesome tools! I am trying to load multiple images (pngs + jpegs) using the ImageLoader. It is working fine but I am looking for a way to be able to not add the images to the screen as soon as they are loaded and make them accessible to child sprites that I can't specify in the container parameter (These sprites are different screens which are created and destroyed as needed and do not exist at the time of loading). So basically, what is the best way to make these images accessible throught my application and not just in the class they are loaded in (this class is still a parent of all the sprites I will need to use these images in). Regards, Ash.
  12. I need to create a selfloader for my flash game. My game doesn't use any frames except the first frame. Most all of the code is contained in classes. I was told that LoaderMax can solve this problem easily, but I can't find any tutorials on how to make selfloaders. Any help would be appreciated, Angelo
  13. Hello everyone, I am new to Loadermax, and I recently started working on a new project that has multiple videos that need to be played on different pages, but at the same time keeping the videos in the background buffering so they can be played easily without waiting for them to buffer. For example, I have 3 pages, on page 1, page 2 and page 3, each individual page will have a different video coming from the same XML file. Right now I have all the videos playing in the same swf and they play as a playlist. here is the code. Any guidance on how to get this working would be greatly appreciated. This is also the link to the video player http://outermedia.ca/videoplayer/godaddy/ XML: <?xml version="1.0" encoding="iso-8859-1"?> <videoList> <LoaderMax name="videoListLoader" load="false" maxConnections="1" prependURLs="http://outermedia.ca/"> <VideoLoader name="videoID0" url="videoplayer/INTRO-1.flv" height ="406" width="720" scaleMode="proportionalInside" centerRegistration="true" alpha="0" autoPlay="false" /> <VideoLoader name="videoID1" url="videoplayer/DB02_C01_T01.flv" height ="406" width="720" scaleMode="proportionalInside" centerRegistration="true" alpha="0" autoPlay="false" /> <VideoLoader name="videoID2" url="videoplayer/DB03_C01_T02.flv" height ="406" width="720" scaleMode="proportionalInside" centerRegistration="true" alpha="0" autoPlay="false" /> <VideoLoader name="videoID3" url="videoplayer/DB_Animation_Ep 01_VBR2pass.flv" height ="406" width="720" scaleMode="proportionalInside" centerRegistration="true" alpha="0" autoPlay="false" /> </LoaderMax> </videoList> Main Class: package { import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; import com.greensock.TweenMax; import com.greensock.events.LoaderEvent; import com.greensock.loading.LoaderMax; import com.greensock.loading.XMLLoader; import com.greensock.loading.VideoLoader; import flash.geom.Rectangle; public class Main extends MovieClip { //an array containing the VideoLoaders in the order they should be played private var _videos:Array; //keeps track of the VideoLoader that is currently playing private var _currentVideo:VideoLoader; //If true, the audio has been muted private var _silentMode:Boolean; //Check if we are in PlayAll Mode (true) private var smoothing : Boolean = true; //tracks whether or not the video was paused when the user moused-down on the scrubber. We must pause for scrubbing, but this tells us whether or not to playVideo() when the user releases the mouse. private var _preScrubPaused:Boolean; public function Main() { LoaderMax.activate([xmlLoader, VideoLoader]); initUI(); var xmlLoader:XMLLoader = new XMLLoader("xml/videoList.xml", {name:"videoList", onComplete:xmlHandler}); xmlLoader.load(); } private function xmlHandler(event:LoaderEvent):void { //get the LoaderMax named "videoListLoaded" which was inside our XML var queue:LoaderMax = LoaderMax.getLoader("videoListLoader"); //store the nested VideoLoaders in an array _videos = queue.getChildren(); //start loading the queue of VideoLoaders (they will load in sequence) queue.load(); //show the first video showVideo(_videos[1]); } //---- UI (User Interface) FUNCTIONS --------------------------------------------------------------------------- private function initUI():void { //ignore mouse interaction with progressBar_mc so that clicks pass through to the loadingBar_mc whose listener handles skipping the video to that spot. controlUI_mc.progressBar_mc.mouseEnabled = false; //ignore mouse interaction with preloader_mc preloader_mc.mouseEnabled = false; //the "layer" blendMode makes the alpha fades cleaner (overlapping objects don't add alpha levels) controlUI_mc.blendMode = "layer"; //set the progress and loading bars and the scrubber to the very beginning controlUI_mc.progressBar_mc.width = controlUI_mc.loadingBar_mc.width = 0; controlUI_mc.scrubber_mc.x = controlUI_mc.progressBar_mc.x; //initially hide the user interface - autoAlpha:0 sets alpha to 0 and visible to false. TweenMax.allTo([controlUI_mc, preloader_mc], 0, {autoAlpha:1}); } private function activateUI():void { //add various listeners addListeners([controlUI_mc, videoContainer_mc], MouseEvent.ROLL_OVER, toggleControlUI); addListeners([controlUI_mc, videoContainer_mc], MouseEvent.ROLL_OUT, toggleControlUI); addListeners([controlUI_mc.playPauseButton_mc, videoContainer_mc], MouseEvent.CLICK, togglePlayPause); addListeners([controlUI_mc.back_mc, controlUI_mc.audio_mc, controlUI_mc.next_mc], MouseEvent.ROLL_OVER, blackRollOverHandler); addListeners([controlUI_mc.back_mc, controlUI_mc.audio_mc, controlUI_mc.next_mc], MouseEvent.ROLL_OUT, blackRollOutHandler); controlUI_mc.audio_mc.addEventListener(MouseEvent.CLICK, toggleAudio); controlUI_mc.next_mc.addEventListener(MouseEvent.CLICK, nextVideo); controlUI_mc.back_mc.addEventListener(MouseEvent.CLICK, previousVideo); controlUI_mc.playPauseButton_mc.addEventListener(MouseEvent.ROLL_OVER, growPlayPause); controlUI_mc.playPauseButton_mc.addEventListener(MouseEvent.ROLL_OUT, shrinkPlayPause); controlUI_mc.scrubber_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScrubber); controlUI_mc.loadingBar_mc.addEventListener(MouseEvent.CLICK, scrubToMouse); //loop through various UI elements and set buttonMode to true and mouseChildren to false so that rollovers/outs work smoothly var controls:Array = [controlUI_mc.playPauseButton_mc, controlUI_mc.back_mc, controlUI_mc.next_mc, controlUI_mc.audio_mc, controlUI_mc.scrubber_mc]; var i:int = controls.length; while (i--) { controls.buttonMode = true; controls.mouseChildren = false; } } //---- NAVIGATION FUNCTIONS --------------------------------------------------------------------------------- private function showVideo(video:VideoLoader):void { //if the new video is the one that's currently showing, do nothing. if (video == _currentVideo) { return; } //The first time through, the _currentVideo will be null. That's when we need to activate the user interface if (_currentVideo == null) { activateUI(); //don't activate the UI until the first video is ready. This avoids errors when _currentVideo is null. } else { //remove the event listeners from the _currentVideo (which is now the old one that will be replaced) _currentVideo.removeEventListener(LoaderEvent.PROGRESS, updateDownloadProgress); _currentVideo.removeEventListener(VideoLoader.VIDEO_COMPLETE, nextVideo); _currentVideo.removeEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress); _currentVideo.removeEventListener(VideoLoader.VIDEO_BUFFER_FULL, bufferFullHandler); _currentVideo.removeEventListener(LoaderEvent.INIT, refreshTotalTime); //If the video is paused, we should togglePlayPause() so that the new video plays and the interface matches. if (_currentVideo.videoPaused) { togglePlayPause(); } //fade out the preloader and then stop() it. If the new video needs to display the preloader, that's okay because the fade-in tween we create later will overwrite this one. TweenMax.to(preloader_mc, 0.3, {autoAlpha:0, onComplete:preloader_mc.stop}); //fade the current (old) video's alpha out. Remember the VideoLoader's "content" refers to the ContentDisplay Sprite we see on the screen. TweenMax.to(_currentVideo.content, 0.8, {autoAlpha:0}); //fade the current (old) video's volume down to zero and then pause and rewind the video (it will be invisible by that time). TweenMax.to(_currentVideo, 0.8, {volume:0, onComplete:rewindAndPause, onCompleteParams:[_currentVideo]}); } //now swap the _currentLoader variable so it refers to the new video. _currentVideo = video; //listen for PROGRESS events so that we can update the loadingBar_mc's scaleX accordingly _currentVideo.addEventListener(LoaderEvent.PROGRESS, updateDownloadProgress); //listen for a VIDEO_COMPLETE event so that we can automatically advance to the next video. _currentVideo.addEventListener(VideoLoader.VIDEO_COMPLETE, nextVideo); //listen for PLAY_PROGRESS events so that we can update the progressBar_mc's scaleX accordingly _currentVideo.addEventListener(VideoLoader.PLAY_PROGRESS, updatePlayProgress); //if the video hasn't fully loaded yet and is still buffering, show the preloader if (_currentVideo.progress < 1 && _currentVideo.bufferProgress < 1) { //when the buffer fills, we'll fade out the preloader _currentVideo.addEventListener(VideoLoader.VIDEO_BUFFER_FULL, bufferFullHandler); //prioritizing the video ensures that it moves to the top of the LoaderMax gueue and any other loaders that were loading are canceled to maximize bandwidth available for the new video. _currentVideo.prioritize(true); //play() the preloader and fade its alpha up. preloader_mc.play(); TweenMax.to(preloader_mc, 0.3, {autoAlpha:1}); } //start playing the video from its beginning _currentVideo.gotoVideoTime(0, true); //always start with the volume at 0, and fade it up to 1 if necessary. _currentVideo.volume = 0; if (!_silentMode) { TweenMax.to(_currentVideo, 0.8, {volume:1}); } //when we addChild() the VideoLoader's content, it makes it rise to the top of the stacking order videoContainer_mc.addChild(_currentVideo.content); //fade the VideoLoader's content alpha in. Remember, the "content" refers to the ContentDisplay Sprite that we see on the stage. TweenMax.to(_currentVideo.content, 0.8, {autoAlpha:1}); //update the total time display refreshTotalTime(); //if the VideoLoader hasn't received its metaData yet (which contains duration information), we should set up a listener so that the total time gets updated when the metaData is received. if (_currentVideo.metaData == null) { _currentVideo.addEventListener(LoaderEvent.INIT, refreshTotalTime); } //update the progressBar_mc and loadingBar_mc updateDownloadProgress(); updatePlayProgress(); } private function bufferFullHandler(event:LoaderEvent):void { TweenMax.to(preloader_mc, 0.3, {autoAlpha:0, onComplete:preloader_mc.stop}); } private function rewindAndPause(video:VideoLoader):void { video.pauseVideo(); //rewind the video so that when we fade it in again later, it's already displaying the first frame and there's no delay skipping to it. video.gotoVideoTime(0); } private function refreshTotalTime(event:LoaderEvent=null):void { var minutes:String = force2Digits(int(_currentVideo.duration / 60)); var seconds:String = force2Digits(int(_currentVideo.duration % 60)); controlUI_mc.totalTime_tf.text = minutes + ":" + seconds; } private function nextVideo(event:Event):void { var next:int = _videos.indexOf(_currentVideo) + 1; if (next >= _videos.length) { next = 0; } showVideo(_videos[next]); } private function previousVideo(event:Event):void { var prev:int = _videos.indexOf(_currentVideo) - 1; if (prev < 0) { prev = _videos.length - 1; } showVideo(_videos[prev]); } //---- PROGRESS AND LOADING BAR FUNCTIONS ------------------------------------------------------------- private function updateDownloadProgress(event:LoaderEvent=null):void { controlUI_mc.loadingBar_mc.scaleX = _currentVideo.progress; } private function updatePlayProgress(event:LoaderEvent=null):void { var time:Number = _currentVideo.videoTime; var minutes:String = force2Digits(int(time / 60)); var seconds:String = force2Digits(int(time % 60)); controlUI_mc.currentTime_tf.text = minutes + ":" + seconds; controlUI_mc.progressBar_mc.scaleX = _currentVideo.playProgress; controlUI_mc.scrubber_mc.x = controlUI_mc.progressBar_mc.x + controlUI_mc.progressBar_mc.width; } //---- TOGGLE FUNCTIONS ------------------------------------------------------------------------------- private function toggleControlUI(event:MouseEvent):void { if (videoContainer_mc.hitTestPoint(mouseX, mouseY)) { TweenMax.to(controlUI_mc, 0, {autoAlpha:1}); } else { TweenMax.to(controlUI_mc, 0, {autoAlpha:1}); } } private function togglePlayPause(event:MouseEvent=null):void { _currentVideo.videoPaused = ! _currentVideo.videoPaused; if (_currentVideo.videoPaused) { controlUI_mc.playPauseButton_mc.gotoAndStop("paused"); TweenMax.to(videoContainer_mc, 0, {blurFilter:{blurX:0, blurY:0}, colorMatrixFilter:{brightness:0}}); } else { controlUI_mc.playPauseButton_mc.gotoAndStop("playing"); TweenMax.to(videoContainer_mc, 0, {blurFilter:{blurX:0, blurY:0, remove:true}, colorMatrixFilter:{brightness:0, remove:true}}); } } private function toggleAudio(event:MouseEvent):void { _silentMode = !_silentMode; if (_silentMode) { _currentVideo.volume = 0; controlUI_mc.audio_mc.label.gotoAndStop("off"); } else { _currentVideo.volume = 1; controlUI_mc.audio_mc.label.gotoAndStop("on"); } } //---- ROLLOVER/OUT HANDLERS --------------------------------------------------------------------------------- private function blackRollOverHandler(event:MouseEvent):void { TweenMax.to(event.target.label, 0.3, {tint:0xFFFFFF}); } private function blackRollOutHandler(event:MouseEvent):void { TweenMax.to(event.target.label, 0.3, {tint:null}); } private function growPlayPause(event:MouseEvent):void { TweenMax.to(event.target, 0.2, {scaleX:1.3, scaleY:1.3}); } private function shrinkPlayPause(event:MouseEvent):void { TweenMax.to(event.target, 0.2, {scaleX:1, scaleY:1}); } //---- SCRUBBER FUNCTIONS ------------------------------------------------------------------------------------ private function mouseDownScrubber(event:MouseEvent):void { _preScrubPaused = _currentVideo.videoPaused; _currentVideo.videoPaused = true; controlUI_mc.scrubber_mc.startDrag(false, new Rectangle(controlUI_mc.loadingBar_mc.x, controlUI_mc.loadingBar_mc.y, controlUI_mc.loadingBar_mc.width, 0)); stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpScrubber); stage.addEventListener(MouseEvent.MOUSE_MOVE, scrubToMouse); } private function scrubToMouse(event:MouseEvent):void { controlUI_mc.progressBar_mc.width = controlUI_mc.mouseX - controlUI_mc.progressBar_mc.x; _currentVideo.playProgress = controlUI_mc.progressBar_mc.scaleX; } private function mouseUpScrubber(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpScrubber); stage.removeEventListener(MouseEvent.MOUSE_MOVE, scrubToMouse); controlUI_mc.scrubber_mc.stopDrag(); _currentVideo.videoPaused = _preScrubPaused; } //---- UTILITY FUNCTIONS ------------------------------------------------------------------------------------- private function addListeners(objects:Array, type:String, func:Function):void { var i:int = objects.length; while (i--) { objects.addEventListener(type, func); } } private function force2Digits(value:Number):String { return (value < 10) ? "0" + String(value) : String(value); } } }
  14. I've been testing this for days now and I've reached my conclusions. I can consistently crash the API while previewing under the following circumstances: multiple JPG images are loaded. I'm using 5 to test: 1. A LoaderMax instance and appending to the queue using a for loop. 2. A LoaderMax instance and appending to the queue using parse() and an array of URLs that point to JPG images. 3. A singular ImageLoader instance in a for loop. If I preview this file in the Flash CC for Mac API, after 5 or 10 previews, the API will crash. If I switch to local image files, there is no crash on preview. If I reboot it will take more previews but after it crashes once, the next crash happens in less than 10 previews. Here is the code I've been using: LoaderMax.activate([ImageLoader]); var queue:LoaderMax = LoaderMax.parse(stringArray, {autoDispose: true, onComplete:completeHandler, onChildComplete:childCompleteHandler}); queue.load(); And the handlers: private function childCompleteHandler(event: LoaderEvent): void { trace("child done") } private function completeHandler(event: LoaderEvent): void { } Is there a memory leak in LoaderMax when loading non-local images in the api? I haven't noticed problems in the compiled SWF, just in the api when previewing.
  15. Hey all, I've problem with videoloader when I want to load bunch of video (each video size 2,30 mb and I have 25 videos its total size is 60 mb) I'dont know what problem is. Here is code below. Please take a look at and tell me what I'm doing wrong: package { import com.greensock.TweenMax; import com.greensock.loading.VideoLoader; import com.greensock.loading.LoaderMax; import com.greensock.events.LoaderEvent; import com.greensock.loading.XMLLoader; import com.greensock.loading.SWFLoader; import flash.display.DisplayObject; import flash.display.MovieClip; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; import flash.system.LoaderContext; import videos.QueueVideoLoader; [SWF(frameRate=30, width=1366, height=768)] public class Preloader extends MovieClip { LoaderMax.activate([SWFLoader, XMLLoader, VideoLoader]); private var loadermax:LoaderMax; private var videosArray:Array; private var queue:LoaderMax; private var libAssets:PreloaderClass; private var loaderContext:LoaderContext; public function Preloader() { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; loaderContext = new LoaderContext(); loaderContext.checkPolicyFile = false; LoaderMax.defaultContext = loaderContext; videosArray = []; loadermax = new LoaderMax({name:"mainQueue", auditSize:false , onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler}); loadermax.append(new XMLLoader("assets/xml/data.xml",{ name: "video_xmldata"})); loadermax.append(new SWFLoader("GolKacti.swf", { name:"content_swf" })); loadermax.load(); } private function completeHandler(event:LoaderEvent):void { queue = LoaderMax.getLoader("videoListLoader"); queue.vars = { auditSize:false }; videosArray = queue.getChildren(); queue.load(true); queue.addEventListener(LoaderEvent.PROGRESS, onVideoProgress); QueueVideoLoader.videoData = videosArray; } private function onVideoProgress(event:LoaderEvent):void { if(event.target.progress == 1) addChild(LoaderMax.getContent("content_swf")); } private function progressHandler(event:LoaderEvent):void { trace("progress"); if(Number(event.target.progress)==1) { // addChild(LoaderMax.getContent("content_swf")); } } private function errorHandler(event:LoaderMax):void { trace("hata"); } } }
  16. Hello, I need load PDF file and show as bitmap in Flash (AS3). I found this code in documentation, but I don´t know how transform byteArray to bitmap? Can somebody help me please? var loader:BinaryDataLoader = new BinaryDataLoader("files/dum.pdf",{name:"filePDF",requireWithRoot:this.root,estimatedBytes:6800}); loader.load(); var files:Array = ["files/dum.pdf"]; LoaderMax.registerFileType("pdf", BinaryDataLoader); LoaderMax.activate([binaryDataLoader]); var queue:LoaderMax = LoaderMax.parse(files,{onProgress:progressHandler,onComplete:completeHandler,onChildFail:childFailHandler}); queue.load(); function completeHandler(event:LoaderEvent):void { var byteArray:ByteArray = LoaderMax.getContent("filePDF"); // I need bitmap from the PDF file ??? } ...
  17. I'm using LoaderMax to parse an XML file and load images and information for a document library, I've got the images being loaded in and added to movieclips but am having issues working with them now they are on stage. Basically I have an array of thumbnails and an array of Images, what I want to happen is when a thumbnail is clicked the full-size image tweens into place. I'm currently using the bog standard flash tweens rather than tweenlite, which might be the issue? Heres my import code. function completeHandler(event:LoaderEvent):void { // Set vars // var mcthumb:Array = new Array; // var mcImg:MovieClip = new MovieClip(); // Grab thumbnails var loadedThumbs = event.target.getChildren()[0].getChildren(); var noThumbs:uint = loadedThumbs.length; // Display Thumbs for (i = 0; i < noThumbs; i++){ loadedThumbs[i].content.name = i; loadedThumbs[i].content.x = 210*i; mc2.addChild(loadedThumbs[i].content); } // trace(loadedThumbs); // Grab images var loadedImg = event.target.getChildren()[1].getChildren(); var noImages:uint = loadedImg.length; // Display images for (j = 0; j < noImages; j++){ loadedImg[j].content.name = j; bigDocWrap.addChild(loadedImg[j].content); } } And this is a edited version of the code I'm using to handle the tweens function callFull(event:MouseEvent):void { var clicked:MovielClip = MovielClip(event.target); //This is the problem line if (isUp == true) { // Do some stuff fadeOut.addEventListener(TweenEvent.MOTION_FINISH, end); function end(event:TweenEvent) { // Some more stuff // Animate large image in mcDocIn = new Tween (clicked, "y", Strong.easeOut, clicked.y, -650, 1, true); } } } And here is the error message Type Coercion failed: cannot convert com.greensock.loading.display::ContentDisplay@39bc1241 to flash.display.MovieClip.at MethodInfo-312() I'm probably missing something elementary, do I need to convert my loaded content to a movieclip in order to be able to get it tweening.
  18. I need the number of images loaded so I can calculate the length of the parent imageholder holder the will be pushed to. I have tried all kinds of ways of tracing. trace(event.target.content as XML ) race((event.target.content as XML).data.LoaderMax.ImageLoader.length()) trace((event.target.content as XML).data.LoaderMax.children().length()) his gave me a series of "null"s, but they do match the correct number of images loaded. how can I get a number ? and can I pass that number ? function imageCompleteHandler(event:LoaderEvent):void { var loadedImage:ContentDisplay = event.target.content as ContentDisplay; loadedImage.alpha = 0; trace(event.target.content as XML ) { TweenLite.to(loadedImage, 5, {alpha:1}); }; galleryArr.push(loadedImage); }
  19. I'm loading a large number of resources of all types with a single LoaderMax instance. Several times during loading I call pause() and then resume() a second or so later. At first it worked, but as my resource list changed, I started having failures. There were no errors reported, I just never received a complete on the load. I found a single swf file with some audio inside that I was loading, which when removed from the load, fixed the problem. The swf is fine, and if I simply remove the pause() and resume() calls, I can load the swf without issue. One thing I noticed is that I get a report of Flash decompressing the swf file twice. I have verified that it is only loaded once, and with pause() and resume() removed, it only decompresses once. [sWF] C:\_projects\game\bin-debug\assets\swfs\Soundtrack.swf - 1,502,520 bytes after decompression [sWF] C:\_projects\game\bin-debug\assets\swfs\Soundtrack.swf - 1,502,520 bytes after decompression Is it possible that pause() and resume() are interacting with the Flash Player's swf decompression somehow? Resuming before it's fully paused or something? Any ideas what's going on here? Thanks! Craig
  20. Hi guys, I was wondering if is possible use the LoaderMax to load a video, than get this content and send it to a another video player, like the FLV Playback from flash. How can I do that? It's possible? Tnx a lot
  21. Greetings from Boise, I'd like to create a single Instance of LoaderMax. I'd like to use that Instance to call one of several .swf's to load, dynamically, via a MouseEvent. myLoader.urlOrRequest = "myURL.swf" throws an 1119: "Access of possibly undefined property urlOrRequest through a reference with static type com.greensock.loading.SWFLoader." What am I missing, please? Thanks ahead of time! case this.palmer_Aerial.eastBuildingAerial: this.removeChild(this.palmer_Aerial); this.removeChild(this.mainTitle); changeLoader.urlOrRequest = "eastBuilding.swf" changeLoader.load(true); break;
  22. I have an AIR for iOS application where I'm downloading remote swfs and then playing them. When I was using a generic loader this worked exactly as intended, but I wanted to switch to LoaderMax. When I use LoaderMax SWFLoader to download the swfs, it works fine when I test in Debug mode on the desktop. However when I run the app on the iPhone, I get these errors: ReferenceError: Error #1065: Variable Icon is not defined. ReferenceError: Error #1065: Variable FLVPlayback is not defined. I've searched the documentation and code files for SWFLoader and its base classes, but I can't find any reference to these properties. However, when I'm creating a new SWFLoader object and I type "icon" or "FLVPlayback" as properties to pass to the SWFLoader, Flash CS6 turns them blue (implying that they're valid parameters to pass to the constructor). The code that doesn't work on the device: var mySwfLoader:SWFLoader = new SWFLoader(val, {name:key, autoPlay:false, onComplete:completeHandler}); The place where I can see "icon" and "FLVPlayback" turn blue: var mySwfLoader:SWFLoader = new SWFLoader(val, {name:key, autoPlay:false,[b] icon:[someVar], FLVPlayback:[someVar][/b], onComplete:completeHandler}); So what I gathered from this is that, for some reason, when running on iOS the app requires that icon and FLVPlayback are defined. But I can't find any documentation on these properties in the LoaderMax classes themselves or online. Can anyone tell me what default properties I can pass to these, or at least give me some documentation on what data types they are/what they're expecting? (I tried passing 'false' to each, hoping maybe they were booleans, but to no avail). Any assistance whatsoever would be appreciated in this matter. Thanks!
  23. Hello! Is it possible to load objects outside the "complete" events ( LoaderEvent )? Right now, it's like this: function initLoader():void { xmlLoader = new XMLLoader( "PathToXml/xml.xml", { onComplete:loadData } ); xmlLoader.load(); } function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( "loaderID" ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } function completeLoader( e:LoaderMax ):void { texture1 = TextureFromBitmapData( LoaderMax.getLoader( "image1" ).rawContent.bitmapData ); texture2 = TextureFromBitmapData( LoaderMax.getLoader( "image2" ).rawContent.bitmapData ); texture3 = TextureFromBitmapData( LoaderMax.getLoader( "image3" ).rawContent.bitmapData ); (...) } And it works, but I have to write this in every class of my app, not handy if I have to change something... That's why I wanted to create a "LoaderScreen" class, that I call where I need, with some methods to help me to handle all the assets / loaders. More or less like this: class LoaderScreen public function LoaderScreen( loaderId:String ) { xmlLoader = new XMLLoader( "xml", { onComplete:loadData } ); xmlLoader.load(); } private function loadData( e:LoaderEvent ):void { loaderMax = LoaderMax.getLoader( loaderID ); loaderMax.addEventListener( LoaderEvent.COMPLETE, completeLoader ); loaderMax.load(); } private function completeLoader( e:LoaderEvent ):void { // nothing here } // HELPERS -- public function loadBitmapdata( id:String ):BitmapData { return mainLoader.getLoader( "texParticleMenuHome" ).rawContent.bitmapData; } And now I want to create a LoaderScreen object, and try to load stuff: class Anywhere public class Anywhere() { var loaderScreen:LoaderScreen = new LoaderScreen( "myID" ); addChild( loaderScreen ); texture1 = TextureFromBitmapData( loaderScreen.loadImage( "image1" ) ); texture2 = TextureFromBitmapData( loaderScreen.loadImage( "image2" ) ); texture3 = TextureFromBitmapData( loaderScreen.loadImage( "image3" ) ); } But it returns "null" when I'm not in the "complete" event handler ( LoaderEvent ). trace( mainLoader.getLoader( "xxx" ) ) in the complete event return something trace( mainLoader.getLoader( "xxx" ) ) outside, return null It's a kind of "AssetsManager" I guess ( based on my framework ) but I only need to know how I can load stuff outside the LoaderEvent. If anyone can help me, or have a suggestion...! Thanks!
  24. Hi, I load lots of files once using LoaderMax. I then pass these files around devices in the local area with https://code.google.com/p/cocoon-p2p/ . Is there a way I can get these locally shared files into LoaderMax? Would be a shame to have to wire up a non-LoaderMax way of accessing files on local devices. Thanks.
  25. Hello, I just started working with LoaderMax and it worked quite well till the point I wanted to load the project into another project also with SWFLoader. It throw's an error that it cannot figure out what the width of the swf is. The same code loading another swf where no LoaderMax stuff was used at all just worked fine. I don't see anything wrong with my code here. I attached the project, so it would be cool if you can try to export the b2s_special.fla and tell me why it is throwing this error: Error: Error #2099: Das ladende Objekte ist noch nicht weit genug geladen, um diese Informationen zu liefern. at flash.display::LoaderInfo/get width() at com.greensock.loading.display::ContentDisplay/_update() at com.greensock.loading.display::ContentDisplay/set rawContent() at com.greensock.loading.core::DisplayObjectLoader/_initHandler() at com.greensock.loading::SWFLoader/_init() at com.greensock.loading::SWFLoader/_rslAddedHandler() at flash.display::DisplayObjectContainer/addChild() Best, Sami b2s.zip
×
×
  • Create New...