Flash Oddity
Results 1 to 4 of 4

Thread: Flash Oddity

  1. #1
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296

    Question Flash Oddity

    I really hope that Valhallen reads this, but Im sure theres other flash specialists out there too .....

    Just to save anyone time: if you don't program in flash or aren't interested in it you may as well move on to a more interesting thread for you ....

    Im building a website in flash and Im doing it so all images are loaded directly from their file folders as they're needed rather than enlarging the file size of the site by importing images and texts directly into the flash document.

    What I'v done is created a Movie Clip Loader, Listener and Load Variables on frame 1 of an actions layer in a master document. Like this:

    Code:
    //---------------<MCL>-----------------\\
    
    var ffMCL:MovieClipLoader = new MovieClipLoader();
    var ffListener:Object = new Object();
    
    ffMCL.addListener(ffListener);
    
    
    //-----------------<LoadVars>-----------------\\
    
    var ffLV:LoadVars = new LoadVars();
    
    ffLV.onLoad = function (success) {
    	if (success) {
    		_level5.loadedInfo.htmlText = ffLV.info;
    	} else {
    		_level5.loadedInfo.text = "There has been an error loading the requested information.  Please contact the Webmaster and report your error.";  
    		
    	}
    }
    Everything here works fine ...

    On frame 10 of the same layer theres this (for now):

    Code:
    stop();
    
    ffMCL.loadClip("slideShw.swf", 5);
    In a seperate Flash Document, created to hold a slide show, I have made a Movie Clip box to display the loaded images, 2 dynamic text fields, and 2 buttons ( previous and next)
    And again on frame 1 of an actions layer of this same document there is the following code:

    Code:
    var slideInfoLV:LoadVars = new LoadVars();
    slideInfoLV.load("vars/slide_info.txt");
    
    var curFrameNum:Number = 0;
    
    function loadFrame() {
    	_level0.ffMCL.loadClip("images/jpegs/Picture" + curFrameNum + ".jpg", this.imagesMC);
    }
    loadFrame();
    
    // ---------------<next slide button>------------------\\
    
    this.nextSlideBtn.onRelease = function() {
    	
    	if (curFrameNum < Number(slideInfoLV.totalFrames) - 1){
    		curFrameNum++;
    	} else {
    		curFrameNum = 0;
    	}
    loadFrame();
    
    }
    I haven't coded for the previous button yet, but we can imagine it'll look very similar to the above code for the next button ....
    And to check this we would simply run the master.swf file. Everything here works well except for one minor (or not so minor) oddity that doesn't seem to be in any reference or troubleshooting manual.

    When one views the slideShw.swf file they simply see the Movie Clip that is meant to load the images (blank, as it should be) and some static text, and everything is where it should be.
    But when we go to the master.swf doc. and run it, we see the images (as we should) but the Movie Clip box that loads these is horribly mis-placed far low and far to the right (so the buttons are actually overlapping about midway through the images).

    The master and slideShw documents are exactly the same size and its not in the alignment of anything I may have done (or not done), I think Iv narrowed it down to this line of code:

    Code:
    _level0.ffMCL.loadClip("images/jpegs/Picture" + curFrameNum + ".jpg", this.imagesMC);
    Its a basically simple line, using simple concatation and relative URL's.
    I blame this line of code because if I comment it out, everything is aligned/placed correctly once again - I just, obviously, don't get my images loaded.
    I can't figure it out, and Iv never seen anything like it before, it just seems so f***ing simplistically silly its maddening.

    Before anyone replies to this I should say a few things about the nature of the site - its a commercial site, which is why Im being so cautious and meticulous about file sizes and simplicity & efficiency regarding future editing of the information, ALL images and texts are loaded, as they are needed from external files, based on external .css's.
    And yes, I could rearrange the placement of things on the slideshw.fla document so everthing is properly aligned and placed when the master.swf is run, but then both the .fla and .swf of the slideshw.* are all messy looking and there lacks a professional looking layout on the backups, everything should be able to run properly as is, Im missing something and its something, I'm sure, very minuscule.

    Any help is greatly appreciated, and I certainly hope Valhallens see's this (He's the one that got me interested in Flash initially).

    I'll pre-thank all respondents now.
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  2. #2
    Flash M0nkey
    Join Date
    Sep 2001
    Posts
    3,447
    heh thanks for the ego boost - tho am not sure it is deserved
    I actually aint had time to play around in Flash for ages - one of the down-sides to working as a php/mySQL developer, not alot of need for me to be doing much flash work these days.

    First thing that springs to mind when reading about the alignment is the Flash bitmap big if memory serves me right this causes a slight shift down & right for any images loaded into flash. Tho am not sure if it would account for the complete misalignment you are seeing it may be a contirbuting factor. Its easy enough fixed you just allow for it in your alignment to start with.

    Next thing is the way in which .swf / .jpg etc are loaded into a flash document. Their registration point (AFAIK) is set at 0,0 (top left) so say your moviclip is 200,200 and you set its registration point at 100,100 (middle) and then load another swf or pic into it the top left corner of the loaded file will start at 100,100. To fix simply move your loader movieclips registration point to 0,0 (or wherever you want the loaded files top left corner to start.

    Also I didn't have time to go through your code in depth (hehe you've developed a completly different style to me - which is cool!) but are you checking that each instance is being loaded into a unique depth? [ Seems to have some good info on it ] I've seen some funky things happen when the depths are not arranged properly - tho nothing like what your describing.

    To be honest unless you're actually using the code to allign the objects

    Code:
    this._x = 100;
    this._y = 100;
    or such like i dont see it being a code issue - more likly something in the organisation of the elements (movieclips) in the fla. If you are still having issues however why not load each instance into a movieclip off-stage and then align it using code at runtime. Just work out the pixel postions for the seperate elements and move them witin an onLoad on the target movieclip. Not the prettiest way of doing it (and takes away somewhat from the AS 2 style coding. But it should give you a good idea if it is a code issues or a problem with your mc alignment.


    v_Ln

  3. #3
    Senior Member IcSilk's Avatar
    Join Date
    Aug 2001
    Posts
    296
    Ahhhh, Val, I knew I could count on ya' mate ............ even before I went to fiddle with it for the day, I was going to reply saying that I think you may have had something with the registration points - just made sense: I hadn't checked it out, it was very plausible and it was something simple. I decided to respond after checking it out since I would have responded again anyways, lol.

    The reason I thought it may have something to do with that line of code is because, it wasn't misaligning anything until after I assigned an instance name to the Movie Clip. Never even thought about the registration points.

    Out of curiosity, though Val, is there a way to re-assign registration points, without re-creating the whole symbol (Movie Clip, Button, Graphic etc.)?

    I was kinda of hurried, so I just jotted down its size and coordinates, deleted it from the library (needed the same instance name so I didn't have to change the coding) and re-created it with a new registration point. Seems there should be a more efficient way of doing this - though it wouldn't surprise me in the least if there wasn't.

    Thanks again, mate, I hope your enjoying the new direction you've taken in PHP/SQL.

    Val ......... you remember at the beginning of the year you sent me to the link to the site of some of your flash projects?? I was wondering if you could re-post that link for me, for study purposes.

    Thanks again, mate

    P.S. Just because Im a curious f***er, you said that the way Im doing it is a different style than yours .......... maybe you wouldn't mind posting a bit of how you would have handled the same project, again ... for informational purposes - Im always looking to learn a new angle!!
    "In most gardens they make the beds too soft - so that the flowers are always asleep" - Tiger Lily

  4. #4
    Flash M0nkey
    Join Date
    Sep 2001
    Posts
    3,447
    Am afraid that site has gone to the great recycle bin in the sky - well not quite i still have a copy of it on my local machine its just no longer online (was done for a UK webdesign competetion - which i took first place in! ) but i can zip up the flash files - might even have some of the fla's to somewhere - and send them across to ya if you want?

    as for the code - its just a different style. Esp with your naming conventions. I always postfix elements with element type in a different way

    eg : myMovieclip_mc, myButton_btn and so on

    and I have a habit of always capitalising the second word but not first - i dunno if you way works the same but using that format when typing in the actionscript pane (expert mode) flash knows that myMovieclip_mc is a Movieclip because of the postfix and displays a popup box with acceptable uses. May do the same for you as you still end yours MC, BTN just never tried that way

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides