Jump to content
GreenSock

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

not all swfs are created equal, some don't play...

Recommended Posts

Hi jack,

this time I can't get my swf to play, they load fine when I use the uicomponent, but when I try loading my swf with your loaders, it doesn't seem to like it, the swfs are often timeline based and have a lot of masks, the swf doesn't want to go past the first frame, here you can see a swf: http://www.sosimplified.com/Holiday/

 

the file is called: Holiday_EMCOR5.swf

 

they are too big to upload, if I try to load it with you loader, I just get a black image, it seems the swf does not play past its first frame.

I wouldn't mind using the uicomponent, but I don't know how to get the music to play again when people want to see the swf again (you probably figured I'm trying to build a portfolio with my flash pieces... not having a lot of luck. :( )

 

Maybe you know why your loader doesn't like my swfs? You can find the fla file in the same folder if you have the time and are interested...

Thanks!

 

Fam

Link to comment
Share on other sites

The problem has nothing to do with LoaderMax (fortunately for me :) ) - you'll see the same behavior with Adobe's Loader class. The problem has to do with the way you coded your FLA. Specifically, you have several scenes (and by the way, scenes are generally frowned upon - they can be problematic) and your "preloader" scene had the following code in it:

 

var percent:Number = Math.floor( (this.loaderInfo.bytesLoaded*100)/this.loaderInfo.bytesTotal );
if (percent == 100) {
nextFrame(); //}

 

nextFrame() should be play() instead.

 

And for the record, I'd definitely recommend NOT building your preloader directly into the swf like that. The best practice is to create a separate swf whose only job is to preload your main swf. That way, it keeps things very focused and there's no bloat getting in the way of displaying the preloader. If you have 100k worth of classes in your swf, they load in the first frame by default (same for library assets that are exported for ActionScript) so they'd all have to load before the preloader pops onto the screen. Not good. Well, not optimal at least.

 

Anyway, I hope that helps.

Link to comment
Share on other sites

HI Jack, sorry but I tried changing the loader code, but it didn't help, the swf's get stuck on the first frame, in almost all my swfs, but the uiLoader works, it doesn't matter if I used scenes or not, all my other swfs won't load, if they have a timeline in them, and most my swfs are a mixture of coding and timeline. I was taught to put the loader in the first scene/frame, so all my swfs are like that, I have no problem getting rid of the loaders but it's not solving my loader problem.

Did you get to load that swf?

 

 

If I could get the UILoader to stop the music and have some control over it like I have with your loader, (when it does load the swfs) I would use the component, but I can't find anything in any forum that shows me how to control the component

 

the following code works too:

but again it's more complicated than yours

 

 

 

var clips:Array = ["mK15.swf", "hol1.swf", "Holiday.swf"];

var index:int = 0;

 

// Stuff to load swf files

var thisLoader:Loader = new Loader();

thisLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoading);

 

var thisMC:MovieClip = new MovieClip();

stage.addChild(thisMC); // Add empty MC initially so the nextClip function can be generic

 

// Removes old MC and gets the next one, waiting until when it has initialized beore adding it to the stage

function nextClip():void {

thisLoader.load(new URLRequest(clips[index]));

}

 

// Tell AS that the loaded file is a movie clip and add it to the stage.

function doneLoading(e:Event):void {

stage.removeChild(thisMC);

flash.media.SoundMixer.stopAll();

thisMC = MovieClip(thisLoader.content);

thisLoader.unload();

stage.addChild(thisMC);

thisMC.play();

}

 

I think I'm going to give up and just load boring old html pages with the click of the button.

If you can think of any other reason these things wont play, please let me know,

 

Thanks,

Link to comment
Share on other sites

Yep, I'm 99.9% sure the problem has to do with the way you've built your FLAs - notice the [longer] example code in your last post that you said worked is actually doing exactly what I suggested - it is calling play() on the root of the child swf.

 

I tried publishing and loading that sample FLA that you posted and it indeed was stuck on the first frame regardless of whether I used LoaderMax or Adobe's Loader (indicating it's not an issue with LoaderMax). Then I tweaked a few things that looked odd to me and noticed that preloader with the nextFrame() thing and when I made the change to play() it worked fine for both LoaderMax and Adobe's Loader. OH! And one more thing I had to do which I forgot to mention (duh) - you had a stop() action at the bottom of the actions in your preloader. That means that if it was fully loaded when that frame ran, it would do nextFrame() and THEN stop()! So your code was causing the stop() when you didn't really mean it to. Move that stop() to the very top of the actions and you should be fine.

 

Whoever taught you to do the preloader thing in your main swf probably wasn't aware that it's considered a poor practice ever since AS3 came along (it was very common in AS2 days, though). If you're pleased with how it performs, though, no biggie.

Link to comment
Share on other sites

Hi Jack, thank you for your patience...

I tried this, as you suggested, changed next frame to play, and put stop on top, but now when I use swf loader, the preloader just keeps playing and playing, the movie never starts...

I know this is not tweening stuff, and I know you say it doesn't work with the adobe loader, but it does seem to work with the flash UILoader, also, when I do make the changes, as see below, as you suggested, the movie publishes fine...

I don't understand why it works for you and not for me...maybe bad karma...:):(

 

 

stop();

import flash.events.ProgressEvent;

function update(e:ProgressEvent):void

{

var percent:Number = Math.floor( (e.bytesLoaded*100)/e.bytesTotal );

if(preloaderMC is MovieClip){

preloaderMC.gotoAndStop(percent);

}

if(percent == 100){

play();

}

}

loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);

 

// Extra test for IE

var percent:Number = Math.floor( (this.loaderInfo.bytesLoaded*100)/this.loaderInfo.bytesTotal );

if(percent == 100){

play();

}

Link to comment
Share on other sites

Could you zip up two example FLA files - one that works for you with UILoader and the other that doesn't work with Loader (or LoaderMax)? I'm especially interested to see an example with on that DOESN'T use scenes and the internal preloader but breaks with LoaderMax. Maybe if I can publish the file(s) on my end it would make things clearer. By the way, the simpler you can make the examples, the better.

Link to comment
Share on other sites

HI Jack, again ,thanks, I will try and make the example files tomorrow, the problem is that the files I need to show are big and long animations, and they are the ones that get messed up, I did however find one solution:

(and this, I swear is why I always get in trouble in life and ActionScript, I just hack my way through it like a chicken without a head)

 

If I load the file into an UILoader, publish it, and then use the resulting swf with your loader, all is well!

 

I know that's not how you're meant to do it, but it works and for now that makes me very happy.

I will make the example files tomorrow,

 

thank you so very much for all your help and patience,

 

Fam

Link to comment
Share on other sites

HI jack,

 

I will try and upload some sample swfs, but just so I can explain what I'm trying to do, here's my test site, I am trying to build a portfolio piece with some of my flash pieces,

clicking the square images opnes the corresponding swf, some are loaded directly with your code, (the first one), the others I first loaded them with UIloader component, see previous issues.

 

http://www.sosimplified.com/site_test/flashEx3.html

 

I will also upload the latest fla file, stripped from everything I don't need, because I have another issue:

queue3.append( new SWFLoader("testUI3.swf", {name:"mainClip", estimatedBytes:30000, container:flash_mc3, autoPlay:false}) );

 

for some reason the container gets ignored, and the movie just loads in the main frame, I do not have that issue with the other swfs, (other issues, but not this one, I will send you 2 attachement, I had to delete a lot to make the file be under 1 meg, but I still have to do it in 2 goes, if you want to see the fla file from the swf Im trying to upload.

 

I hope you can help with this, though I'm beginning to think I should not be making a portfolio of flash pieces...:(

 

Again, thank you so very much,

 

Fam

Link to comment
Share on other sites

PS the xml folder for the coutryMap piece is in the test_fam.zip file, TX!

Link to comment
Share on other sites

Wow, you're using a super old version of all the classes. Definitely update the the latest and greatest: http://www.LoaderMax.com

 

The other problem was that your code in the subloaded swf was referencing the stage but that value is null until the swf is added to the display list (that's just how AS3 works). I altered SWFLoader so that it puts the Loader (Adobe's) into the ContentDisplay's display list initially and then re-adjusts when the raw content loads, thus as long as you add the ContentDisplay to the display list (by defining a "container" in the vars parameter for example), it will avoid those null reference errors.

 

When I used the latest version with your example, it appeared to work fine. Please give it a shot and let me know if you get the same results.

Link to comment
Share on other sites

HI Jack,

 

I tried with the newest downloaded version but my result is still the same...did you change any code at all on the fla files?

Or did you just change some code on your class files?

Please let me know, thanks, Fam

Link to comment
Share on other sites

HI jack, another problem, when I update the com file, I now get an error message

 

param count mismatch

virt params=3 optional=3 com.greensock.loading.core::LoaderItem/_dump()

over params=2 optional=2 com.greensock.loading.core::LoaderItem/_dump()

VerifyError: Error #1053: Illegal override of MP3Loader in com.greensock.loading.MP3Loader.

 

at global$init()

at Gowan_fla::MainTimeline/frame87()[Gowan_fla.MainTimeline::frame87:2]

 

 

in my older fla file, this one:

 

http://www.sosimplified.com/site_test/flashEx3.html

 

http://www.sosimplified.com/site_test/flashEx3.fla

 

 

it works when I switch back to my outdated version of com.

Sorry to be such a pain...

Thanks, Fam

Link to comment
Share on other sites

I tried with the newest downloaded version but my result is still the same...did you change any code at all on the fla files?

Or did you just change some code on your class files?

I did have to change a couple of errors in your files, yes:

 

1) You had double (conflicting) import statements like this:

 

import gs.*; // import gs.easing.*; // import gs.plugins.*; // 
import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.*;

 

2) Instead of flashEx5 loading testUI3.swf (that UILoader proxy workaround you did), I loaded CountryMap_022.swf directly into flashEx5. (it loaded either way though)

 

By the way, your stuff was coded so that it adds various visual elements (MovieClips, etc.) to the stage directly which looks pretty weird. In other words, it doesn't stay inside the swf that's loaded - it jumps out directly onto the stage. For example, here's some of your code in that subloaded swf:

 

var graph:graphMC = new graphMC();
stage.addChild(graph);
graph.x = timeLine.x;
graph.y = timeLine.y;

 

I'd strongly recommend against doing that sort of thing. You can see why in your example - it looked like you were trying to load that swf into another container that was then animated across the screen, but since as soon as your swf loaded, it put a bunch of content directly onto the stage, it never animated with the container (that content was no longer in the container). See what I mean?

 

param count mismatch

virt params=3 optional=3 com.greensock.loading.core::LoaderItem/_dump()

over params=2 optional=2 com.greensock.loading.core::LoaderItem/_dump()

VerifyError: Error #1053: Illegal override of MP3Loader in com.greensock.loading.MP3Loader.

 

at global$init()

at Gowan_fla::MainTimeline/frame87()[Gowan_fla.MainTimeline::frame87:2]

 

It sounds like you didn't really update all your GreenSock classes. It almost sounds like you have a really old version of LoaderItem but a newer MP3Loader or something. Please make sure you completely kill/delete/nuke all old versions of all GreenSock classes and download them again. Like I said, things loaded without any errors when I updated your classes, fixed the stuff listed above, and republished.

Link to comment
Share on other sites

Hi jack, I dutyfully took away

 

import gs.*; // <-- OLD!

import gs.easing.*; // <-- OLD!

import gs.plugins.*; // <-- OLD!

 

so I only had this left:

 

import com.greensock.*;

import com.greensock.loading.*;

import com.greensock.events.LoaderEvent;

import com.greensock.loading.display.*;

 

re-imported again your new com folder, but it's still not working, I don't know what to fix on the CountryMap_022.fla file, if you did some editing there too, could you send the file back to me? Or if you have a folder with thefiles in it and the com folder you used and zipped it and it works for you it should work for me, right?

I'm sorry this is all getting a little out of hand and I understand that it's not really your problem, also, by replacing the com folder with the latest and greatest I now still get that same error, what am I doing wrong? I just replace the com folder in my classpath folder, correct? And once the swf is correctly published, it doesn't need the com folder anymore, right? as I don't have to upload it to my server when publishing, am I missing something really obvious?

One more go-around and then I may have to give up...but I hope your next reply will fix it...

Thanks, I really appreciate it...

Fam

 

PS I did attach the swf I get as a result to show you what i mean

Link to comment
Share on other sites

Unfortunately, I just don't have time to analyze, troubleshoot, and fix the 600+ lines of code in your FLA but the hopefully my explanation above helps you understand the core problem (adding stuff to the stage which removes it from the subloaded swf) so that you can address it on your end.

 

I've attached the files that loaded fine for me when I published them (aside from the funky stage-adding stuff).

 

Do the attached files work for you when you publish them? I don't get any errors whatsoever.

Link to comment
Share on other sites

Hi Jack,

 

Of course I don't expect you to troubleshoot my files, that would be crazy, I just thought you were successful just by swapping the com folder with the new one.

The error I get is not in uploading this countryMap_22.swf but in loading the swfs I managed to upload succesfully in the previous file, see this link.

 

http://www.sosimplified.com/site_test/flashEx3.html

 

The files are just way too big to get to you, I'll just go back to the old com folder, which loads the other swfs fine without error, and forget about this particular countryMap_22.swf on my portfolio page, as I don't see how I can add the movieclips to the stage without adding them to the stage, if you see what I mean. I'm juts not good enough in as3 to figure it out. Anyway, such is life in code land!

 

Again, thank you so much for your time, I think we gave it a good enough try, as I get better maybe slowly all these issues will get ironed out!

 

Fam

Link to comment
Share on other sites

I saw some null object errors when I viewed that page that you linked to (the one you said worked). Specifically, when I clicked the middle square.

 

...as I don't see how I can add the movieclips to the stage without adding them to the stage, if you see what I mean. I'm juts not good enough in as3 to figure it out.

The concept is to addChild() your stuff to the root of your swf or some other container, so instead of this:

 

stage.addChild(myObject);

 

you'd do this:

 

myContainer.addChild(myObject);

 

And the "myContainer" could be the root of your swf which could be referenced as "this" by code that's on the root timeline or in your main document class.

 

Anyway, I hope that helps. Good luck with the project.

Link to comment
Share on other sites

thanks Jack, I know I sometimes get null errors too, but only if I try to click too fast from one to another, which I think is because the sound is not quite done loading and I'm trying to unload it, but with the newest com folder the whole thing doesn't work, but that's Ok for now, I am going to use the html swf loading method instead.

 

I also tried using container instead of stage but I get errors that way too, I'm going to follow the advice from a good teacher I once had: walk away from it and it might come to you later!

 

Again, thank you for all your help, if I ever figure out any of these problems, I'll let you know!

 

Thanks,

 

Fam

Link to comment
Share on other sites

thanks Jack, I know I sometimes get null errors too, but only if I try to click too fast from one to another, which I think is because the sound is not quite done loading and I'm trying to unload it, but with the newest com folder the whole thing doesn't work, but that's Ok for now, I am going to use the html swf loading method instead.

So did you download the zip I posted and publish it? Did it give you errors? If so, please share the details because I was able to publish it without any problems. I'd certainly advise against using an outdated version of LoaderMax because you'd be missing out on some new features and bug patches. I'm curious to hear if you were unable to compile the file(s) I uploaded.

Link to comment
Share on other sites

HI Jack, noi I don't get errors with the files you sent back to me, but that's only one swf that I need to load in my portfolio, and that one adds everything to the stage instead of to the container, and I can't figure out how to fix that, the one I get the error on is the one on this site:

 

http://www.sosimplified.com/site_test/flashEx3.html,

 

the middle button, which you said you also get an error on, but a null child error, which doesn't really affect the performance, but with the new com file, the fla doesn't even publish, so it does not work for me, as I can live with an error when people click too soon, before the sound has done loading, I can probably fix that by putting a delay on the click here to close button, but I can't fix the fla file not publishing.

 

all the files are on this site

 

http://www.sosimplified.com/site_test/flashEx3

 

if you were to use your new com folder with this file, you'ld get that error: (the swfs are also in that folder http://www.sosimplified.com/site_test/ )

 

param count mismatch

virt params=3 optional=3 com.greensock.loading.core::LoaderItem/_dump()

over params=2 optional=2 com.greensock.loading.core::LoaderItem/_dump()

VerifyError: Error #1053: Illegal override of MP3Loader in com.greensock.loading.MP3Loader.

 

at global$init()

at Gowan_fla::MainTimeline/frame87()[Gowan_fla.MainTimeline::frame87:2]

 

 

but honestly, I really don't expect you to waste any more of your time on this, I am grateful for all the time you already spent trying to help me, I know it must be really hard trying to fix colossal messes like mine, but if it's nagging you, this is where it all lives!

 

Fam

Link to comment
Share on other sites

Hi jack, sorry to be back again with this,

but something else curious is happening now, I got the swf to load in its container in (see attached) flashEx8.fla in the testComOld folder, using a previous version of com, but I get an error and the swf 's buttons don't work. In the testComNew folder, flashEx9.fla, using your latest com files, the swf still doesn't load within my container, but the loaded swf is interactive. The loaded swf: CountryMap is from same fla file in both cases, also attached.

 

It's driving me crazy! So, if you can still find it within yourself to give this one more glance, I would really appreciate it, if not, I really understand, and I apologize for being a pain!

 

Thanks, and happy holidays!

 

Fam

Link to comment
Share on other sites

The "old" version actually wasn't working - it was throwing an error as soon as it hit your "stage" reference in your code. As soon as it threw that error, it halted execution of the rest of the code - that's why your buttons didn't work. It stayed in the container because your code that was ripping it out of the container and trying to add it to the stage was failing.

 

With the updated version of LoaderMax, SWFLoader now allows subloading swfs to see the stage initially (as long as the container you're loading it into is in the display list). So in the new version, your "stage" references weren't null, so it allowed your code to execute (as it should). Your code was removing it from the swf and depositing it onto the stage which is why the new version didn't stay inside the container. See the problem? So again, the old version wasn't working - it was throwing an error that halted execution of your code.

 

I've attached an updated version of your FLA that works - I had to alter a few things, like obviously not adding the "container" to the "stage" and I moved the addChild(container) line down below where you had a loop that was basically taking all the children of the root and moving them into different containers, otherwise it would try adding the root container to itself (no can do).

 

I hope that helps clear things up.

Link to comment
Share on other sites

Yessss!!! It works! I am so unbelievably grateful!

Thank you so much, I will now study the code and dedicate any further work I ever produce to you!

Best holiday present ever, thank you, Happy Holidays,

Hope not to bother you any time soon,

 

Fam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×