A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Ok, this is really frustrating me now.

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    20

    Ok, this is really frustrating me now.

    I'm not sure if circular preloaders are even used in most Flash-made applications, but I want to make one regardless. By circular, I mean that a radius starts at the North point of the circle, travels clockwise around the circle, about the centerpoint, a full 360 degrees AND fill in its path while doing so. So it'd basically be like taking a piece of chalk, putting one end on a dot on a chalkboard and dragging it, longways, around that dot.

    Now the problem is... I can't figure out how to do this. I can get Flash to do this through the beginFill() and endFill() functions and a single for loop, but that's in one fell swoop. My problem is that I can't get it to do this while loading something. I can get a line to go about a centerpoint in a circle, no problem, but I just can not, for the life of me, figure out how to make the path the radius takes fill up as it's dragged along. And just when I thought I figured it out and thought I could use the beginFill() and endFill() functions AS the line was being dragged, I saw that it didn't work and what I was really doing was dragging along a thin slice of a pie that doesn't fill its path. I'd show you the code I tried, but I closed the file and didn't save the changes. I can show you the code I used to make the line go about the centerpoint though.

    Code:
    CIRCLE._rotation = PERCENT * 360
    //CIRCLE is a 0 x 50, 1 thickness, blue movieclip line with registration 
    at its middle-center point and coordinates of 275, 300.
    //PERCENT is the percentage of the movie currently loaded

  2. #2
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Just a thought... since I did'nt spend much time with the drawing methods..

    How about a "slice" mc, say 36 degrees .. and then copy it 10 times and rotate it..

    sliceMC.rotation += 36

    By making the slice small enough you won't be able to se that it is not an animation.
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    20
    That sounds like it could work, only I don't know how to copy a movieclip on the fly, and controlling all ten from the start would be a real pain in the ass.

    Correction, I know of a method called duplicateMovieClip(), but it doesn't seem to work for me.

  4. #4
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Hmm me and my big mouth...

    I dug up some old code that does what you need..

    Make an MC, name it sliceMC (make sure the registration point is in the tip of the slice), find it in the library( click it and press ctrl+l or command+l).

    Now right-click the sliceMC and select "linkage", give it the identifier "sliceMC" ...

    now the code....


    Code:
    var rotation = 0;
    var size = 10;
    
    for (i=0; i<size; i++) {
    		this.attachMovie("sliceMC", "sliceMC"+i, i+1); //makes a new instance of slideMC
    		this["sliceMC"+i]._x = 150; // x and y position...
    		this["sliceMC"+i]._y = 150;
    		this["sliceMC"+i]._rotation = rotation; //sets the rotation
               rotation += 36; //the sliceMC is 36 degrees wide so this moves the next slice to where the previous stops..
    }
    Now all you have to do is to write a preloader, and each time the 10%percentLoaded is true.. ad a slice..

    Hope it makes sense.. else you can start out and get back to me if the **** hits the fan...

    //Edit: the "this" in the "this.attachMovieClip" .. is an empty movieClip you place on stage and then place the code on its first frame...

    or use the more correct way... name the empty MC and use _root.emptyMC.attachMovieClip on the first frame in root..
    Last edited by gobbles; 07-17-2006 at 05:47 PM. Reason: forgot a detail...
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

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