A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 43

Thread: A warning about two Flash bugs!

  1. #1
    Stupid Little Dreamer
    Join Date
    Aug 2000
    Location
    Toronto
    Posts
    583
    Bugs or eccentricities -- you be the judge.
    ___________________________________
    The first one is simple to describe. If you enter Actionscript manually (expert mode), then be careful about extra spaces if you end up deleting all the script. What I mean is, I used to have something like
    some_variable = "whatever";

    gotoAndPlay ("SOMEFRAME");


    Now in this example, say I delete both lines of script, but leave the line returns untouched. Easy to do, since it certainly looks as if I've cleaned out all the script. But when I click on another frame, I see there's still a little 'a' inside the frame I just left -- in other words, Flash sees the line return and assumes there's actionscript lurking within.

    Normally, this shouldn't be a problem. But it was for me. Movie A loaded movie B into a clip; movie B happened to have some of this phantom actionscript on its first frame; when testing the movie (either within Flash or through a browser), a library symbol that did not exist on the stage of either movie would inexplicably appear when movie B was loaded.

    Weird, eh? I tried enough combinations of things to conclude that the phantom actionscript was at fault. I deleted it and everything worked. Absolutely bizarre. So be aware these things can happen.
    ___________________________________
    The second problem is something too complicated to describe, so instead I'll just give you the advice. Essentially, Flash appears to have some type of 'complexity limit' per layer. I had multiple instances of the same complex movie clip together on the same layer, and very, very bizarre things started happening. After 90 minutes of weeping and gnashing of teeth, I solved the problem by putting each instance on its own layer.

    I know what you're thinking -- I must have missed some other little thing. But I didn't. I checked everything and I mean everything. Three times. There was no reason Flash shouldn't have worked with everything on the same layer, and equally no reason that using multiple layers should've made any difference. But that's the way it was.

    So -- in summation -- in my opinion, if you watch out for phantom actionscript leftovers, and don't put multiple instances of complex movie clips on the same layer, you just might save yourself some future tears.

    A small favour:
    Please post a reply -- anything (even just a smiley) -- so that this thread won't get buried thirty minutes after it's born. Maybe it can even garner a "hot" icon, ensuring that plenty of Flashers will see it. Thanks.

    And certainly, post your own "Stories from the Beyond" so we can all read the warnings.

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Posts
    168
    Thanks James.

    Keeping it on top...

    --dan

  3. #3
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi James,

    let me add one that at some time cost me half a day to figure out (and was one reason to abandon flash completely in favor of ming): everybody knows that // starts a comment - everything from there to the end of line is comment, next line is code again. Now, MM has decided to generate different code for
    if(something) // test for something here
    { ... code if true here
    }
    than for
    if(something) { // test for something here
    ... code if true
    }
    Everyone who has ever programmed in a language using { } for statement grouping and // or # for comments to end of line just would not expect the first case to associate the if part with the comment and always execute the code in brackets

    Musicman

  4. #4
    Stupid Little Dreamer
    Join Date
    Aug 2000
    Location
    Toronto
    Posts
    583
    Musicman:

    What's ming?

  5. #5
    Senior Member mikeli's Avatar
    Join Date
    Apr 2001
    Location
    Country NSW, Australia
    Posts
    202
    Thanks.........

  6. #6
    Senior Member flipsideguy's Avatar
    Join Date
    Dec 2000
    Location
    Sweden
    Posts
    834

    Thank you

    Will keep that in mind. will definitly be helpful as my movies are getting more and more complex.

  7. #7
    Senior Member
    Join Date
    Jun 2001
    Location
    Philippines
    Posts
    117
    here's the smiley to keep it on top

    anyway i was wondrin' too.. what is "MING"?


  8. #8
    Senior Member
    Join Date
    Mar 2000
    Posts
    472

    Ming

    From the primordial soup of Dave at Opaque Industries:

    http://www.opaque.net/ming/

    Richard

  9. #9
    Senior Member
    Join Date
    Nov 2000
    Location
    Manchester, UK
    Posts
    454
    Cheers Dude! Keeping it up there!

  10. #10

    wtf is ming?

    Keep this ontop, I had the same prob too

    I think It has more likely for the second point to occure if you include action script, so I put MCs on separate frames when they have script in the onclip part

    Hmmm whats ming?

    [Edited by SpyderMurphy on 08-14-2001 at 05:55 PM]

  11. #11
    I wondered about those persistant little "a"s

    Nice one Cyril!

  12. #12
    Senior Member
    Join Date
    Apr 2001
    Posts
    150

    The SWF Files

    Cool thread. I will contribute with one of my wierd glitches.

    I was developing an Org Chart all in flash, I fully designed it with a bitmap image as a background. Everything was going fine until I started adding frames and then all of a sudden my bitmap degraded severely on the swiff. Like above, at first I didn't understand what was causing it. I tried messing with my export setting, I checked every setting possible. I threw my layers all over the place and after a lot of stress I finally realized (to an extent) what was causing it. But that didn't help because the extra frames where needed, so I had to just apply a strong alpha on the bitmap so that the unavoidable pixelization would not show.

    And that's my flash tale...

  13. #13
    Member
    Join Date
    Aug 2001
    Posts
    43
    Thanx alot James.
    (I just keep thinking about this MING...)

    Zoo-Mann



  14. #14
    Junior Member
    Join Date
    Mar 2001
    Posts
    20

    Smile hey you!

    thats my part to keep your thread alive, thank you. and: stork1515, i like your banner, its looking fine!

  15. #15
    Stupid Little Dreamer
    Join Date
    Aug 2000
    Location
    Toronto
    Posts
    583
    Stereokitchen:

    Actually, there's a solution to your bitmap problem. You set _quality = best; at the beginning of your movie.

    What's happening is, believe it or not, not a bug, but rather a poorly documented and somewhat arcane 'feature' of Flash. Back in the days of Flash 2 and 3, when computers were much slower, Macromedia decided that if a bitmap lingered on the stage for more than one frame, it would probably just slow everything down (like tweens on other layers). Its solution was, after the initial frame, to turn off the bitmap's anti-aliasing unless the quality setting overrode it.

    I don't think there's a need for this 'feature' anymore; I sure hope Flash 6 does away with it -- or at least makes puts something about it in the help files.

  16. #16
    Senior Member
    Join Date
    Apr 2001
    Posts
    150
    Wow. Thanks for the info.

  17. #17
    Senior Member
    Join Date
    May 2000
    Posts
    124

    Could be... [2nd problem]

    This could be the result of Flash's inherent limit on the number of actions that Flash can perform in a single frame. If your setup script is trying to do more than 20,000 actions in a single frame, Flash will decide that there is probably an infinite-loop bug and stop the script from executing further... leaving you with a partial result.

    Unfortunately, I don't think there's a resolution to this.

  18. #18
    Member
    Join Date
    Jun 2001
    Posts
    59

    Musicman

    I have played a little with Ming, but that was before actionscript 5 was starting to be supported. I have the latest CVS version compiled but been too busy to play with it a whole lot. So I am wondering, how is the actionscript 5 support? Worth while to play a bit with? Or still buggy, hold off until it gets a little more stable.

    I am used to working with buggy and beta libs, so if it isn't too bad (as in it actually does support good portion of the functions, and you don't have to go digging through any of the header files to debug some of the wacky stuff) then I think it would be worth giving it a shot.

    Jon

  19. #19
    Stupid Little Dreamer
    Join Date
    Aug 2000
    Location
    Toronto
    Posts
    583
    In my case, I don't believe the actionscript limit came into effect. All my actionscript was quite simple (stop, gotoAndPlay, a few if's and checking on variables). Just for the sake of clarity, I'll describe what happened (for the benefit of those who are particularly interested, as well as insomniacs).

    In this Flash movie, the user (a young child) is in a supermarket, and told to get, say, 4 oranges, or maybe 9 loaves of bread (this is selected randomly, from a list of 40 food items). Let's say 4 oranges for this example. Next the child sees three large circles; the first contains 7 oranges, the next 4 oranges, and the last 10 oranges. The child has to pick the correct amount.

    So first I had foodclip, which contained 40 keyframes (one for each food item); script would move it to the appropriate frame.

    Next, I had circleclip, which had 10 keyframes (since the random number of food items they were to choose would be from 1 - 10). On the first keyframe, there was 1 instance of foodclip, and its instance name was foodclip1. The sixth keyframe had 6 instances, named foodclip1 through foodclip6.

    Now here's the weird part. I discovered that foodclip6 (which occurred in the 6th through 10th keyframes of circleclip) wouldn't react to actionscript targeted at it (like foodclip6._visible = false). I figured I'd made any number of errors, but after many, many checks, I confirmed I'd done everything right. I even tried copying foodclip5, for example (which behaved properly), and giving the copy the instance name of foodclip6. It still wouldn't work.

    I tried everything I could think of. Sometimes, after complicated procedures I won't go into, I'd succeed in getting foodclip6 to work -- only to find that foodclip7 OR foodclip9 had now stopped working!!!!!

    I tell you, I was at the end of my rope. Tears were not far off. Then I tried what I figured would be my last hope.

    Up till this point, all of the foodclip symbols within a given circleclip keyframe had existed on the same layer. On a whim, I separated them so that each had its own layer.

    This solved my problem.

    I have no idea why this worked, but it did, thank God.

    Anyway, those of you who made it this far in my post now have a better understanding of just how screwy Flash can get. But I still love the damn thing.

  20. #20
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi there,

    one piece of advice debugging intricate cases: it is worth learning to use an actionscript viewer and trying to understand how your code looks in primitive instructions.
    At least for repetitive structures (James' example) any deviations might catch your eye.
    When I was caught by the funny comment handling, I got close by adding trace() calls all over the place, but the final confirmation was a line "branch if true 0" in the actionscript following code to evaluate the condition

    There have been a few questions about Ming: it is a library of functions to write swf movies, and it can be used both with C and C++ for writing specific programs, and with server scripting languages such as php and perl. Unlike generator, there is no design template but the entire movie is scripted.
    To get an idea of what it is all about, this is just a button...
    Code:
    #!/usr/bin/perl
    
    use SWF qw(:Text :Button :Clip);
    
    SWF::Ming::setScale(1.0);
    
    print "Content-type: application/x-shockwave-flash\n\n";
    
    $movie = new SWF::Movie();
    $movie->setDimension(4000,3000);
    sub makerect
    {       my($r,$g,$b,$x,$y) = @_;
            my $s = new SWF::Shape();
            $s->setRightFill($s->addFill($r,$g,$b));
            $s->movePenTo(0, 0);
            $s->drawLineTo($x,0);
            $s->drawLineTo($x,$y);
            $s->drawLineTo(0,$y);
            $s->drawLineTo(0,0);
            return $s;
    }
    
    sub makerectborder
    {       my($r,$g,$b,$x,$y,$r2,$g2,$b2,$bw) = @_;
            my $s = new SWF::Shape();
            $s->setRightFill($s->addFill($r,$g,$b));
            $s->movePenTo(0, 0);
            $s->drawLineTo($x,0);
            $s->drawLineTo($x,$y);
            $s->drawLineTo(0,$y);
            $s->drawLineTo(0,0);
            $s->setRightFill($s->addFill($r2,$g2,$b2));
            $s->movePenTo($bw,$bw);
            $s->drawLineTo($x-$bw,$bw);
            $s->drawLineTo($x-$bw,$y-$bw);
            $s->drawLineTo($bw,$y-$bw);
            $s->drawLineTo($bw,$bw);
            return $s;
    }
    $btn = new SWF::Button();
    $btn->addShape(makerect(0xcc,0xcc,0xcc, 1000, 150), SWFBUTTON_UP|SWFBUTTON_HIT);
    $btn->addShape(makerectborder(0xff,0,0, 1000, 150, 0xcc,0xcc,0xcc, 20), SWFBUTTON_OVER|SWFBUTTON_DOWN)
    $btn->addAction(new SWF::Action("
    play();
    "), SWFBUTTON_MOUSEUP);
    $i = $movie->add($btn);
    $i->moveTo(1500, 2500);
    $movie->nextFrame();
    $movie->output();
    Since it is all scripted, it can do a few things generator probably could not do. Consider a simple image preview (like conventional photo contact sheets). A script could count your landscape and portrait shots and optimize the layout before images are placed. For another similar example, follow one of the "character set" links at a friend's font site in its infancy)
    Ming is available from http://www.opaque.net/ming - and there are links to a ming forum and a ming documents site which you should probably check out as well.
    @panang: I learnt about ming when it was using F4 and I was fighting with flash and/or windows on a heavily scripted project which was actually my first flash (other than static pages like this music sheet). It did not take me too long before any actionscripts where actually #included from my networked linux system so they would not be lost when flash crashed. I soon got involved with beta-testing the new compiler and contributing to it. I consider it fairly stable. You do not have to mess with header files (unless it won't compile on your system)
    A word of warning: like all lex/yacc based projects, the compiler does strict checking - you have to place a semicolon at the end of every statement. Also there is no mixing of F4 and F5 stuff - you can select F4 behaviour and use telltarget and "/movieclip" or use default F5 and write with() and _root.movieclip in your code

    Musicman


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center