Page 23 of 33 FirstFirst ... 132122232425 ... LastLast
Results 221 to 230 of 327

Thread: new to flash 2004 mx

  1. #221
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    Which version is that from? No, i did not mean that. I meant the one I linked to.
    lol, i know medyman. But you gave me a post which was a month back( you could check the link again)

    EDITED: ok, you corrected it

    OOT stands for out of topic. my bad. I forgotten you prefer clear* language

    Code:
    mclL.onLoadComplete = function() {
    	count++;
    	if(count == ((images.length-2)*2)) {
    		panel1.onEnterFrame = Scroll;
    	}
    }

    Okie, since i can`t realli write in as. My last 2/3 posts were all crappy code. Mind if i say it out in eng? The thing i/we have to do now is to declare the Scroll( how fast/slow its move etc. I should be correct by now

  2. #222
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    lol, i know medyman. But you gave me a post which was a month back( you could check the link again)
    Yeah, sorry about that. I fixed the link.

    OOT stands for out of topic. my bad. I forgotten you prefer clear* language
    Lol...that's clear for someone who knows what OOT is. I'm not up on my web acronyms.

    Okie, since i can`t realli write in as. My last 2/3 posts were all crappy code. Mind if i say it out in eng? The thing i/we have to do now is to declare the Scroll( how fast/slow its move etc. I should be correct by now
    Yes...that's correct. That's exactly what the step after the next one is

    Before we start moving things, lets position the panels. Right now both panels are on top of each other.

    First, create the Scroll() function;

    Code:
    function Scroll() {
       trace("this is when the panel would start scrolling)"
    }
    Next, we'll need some way of positioning the 2nd panel (the 1st one is already where we want it). Let's create another function for that. You could do it within Scroll() but it's clearner this way.

    We'll call it position.
    Code:
    function position() {
    		panel2._x = panel1._width;
    	}
    }
    This will position panel2 right after panel1, so they look like they are joined. Now, add a call to this function within Scroll();

    Code:
    function Scroll() {
    	position();
    	trace("this is when the panel would start scrolling)" 
    }
    Because we're caling Scroll() onEnterFrame, that means that the postion() function will also fire once per frame. We actually only want it to fire once for the entire movie. If it was firing once per frame, panel2 would never move because we would keep delcaring the _x property to be the same.

    So, to do this...
    We create a boolean variable that we will set when postioned() runs for the first time. Once the variable is set...we'll use an if statement to test if we should run position() or not. If the variable is set, we won't run it. If it is set, we will run it. Lets call this boolean variable positioned

    So, this gives us:

    Code:
    var positioned:Boolean = false;
    function position() {
    	if (positioned == false) {
    		panel2._x = panel1._width;
    		positioned = true;
    	}
    }
    Are you with me so far?

  3. #223
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    lol. I sure am with you. Not asleep O.O but with no flash software. the first 2 parts of the codes is it linked together? I having abit of confusion here by the traces.

    so, scroll() is for panel1 & postion is for 2. I think i change it to scroll1()& scroll2(). At least,i know what are they for . the last 2 wks, we having enough confusion over images, rawdata etc.

    Eh, medyman could you pls use // instead of trace ( its for debugging purposes i know). the boolean part could we leave it till we done with the above part 1st

    Code:
    function Scroll() {
    	position();
    	panel2._x = panel1._width;
    }
    is it something like that??

    Code:
     function Scroll(){
    }
    function postion(){
    panel2._x+panel._width
    }
    is this the clearer way which you spoke of?


    Because we're caling Scroll() onEnterFrame, that means that the postion() function will also fire once per frame. We actually only want it to fire once for the entire movie. If it was firing once per frame, panel2 would never move because we would keep delcaring the _x property to be the same.
    I not quite sure with what you trying to say. sorrie (perhaps i need to test it out be4 getting a clearer picture)
    Last edited by hyk; 05-07-2008 at 02:54 PM.

  4. #224
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    so, scroll() is for panel1 & postion is for 2. I think i change it to scroll1()& scroll2(). At least,i know what are they for . the last 2 wks, we having enough confusion over images,
    Umm...no. Scroll() is to scroll the movieclips. position() is to position them. Panel1 is already where we need it to be so no need to position it. That's why panel2 is the only thing in the position movieclip.

    Eh, medyman could you pls use // instead of trace ( its for debugging purposes i know).
    Yea, sure. But don't get caught up on the traces. They're just an easy way to know what's going on.

    So Scroll() and position() are two seperate functions. The entire bit should look like this:

    Code:
    var positioned:Boolean = false;    // Is panel2 positioned yet?
    function position() {
    	if (positioned == false) {      // if we've already positioned it, don't run this.
    		panel2._x = panel1._width;  // position panel2 at the end of panel 1;
    		positioned = true;          // panel2 is positioned, no need to run the postion() function anymore
    	}
    }
    
    function Scroll() {
    	position();                   // First position panel2 and then we'll start scrolling it.
    	// trace("scrolling");
    }
    Make sense?

    Note: You won't see a visible difference after doing this but trust that it's done what you want.
    Last edited by Medyman; 05-07-2008 at 02:59 PM.

  5. #225
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    ah i see, so panel1 we cleared it a few posts just now* (sorrie to bother your sleep).

    Code:
    var positioned:Boolean = false;    // Is panel2 positioned yet?
    function position() {
    	if (positioned == false) {      // if we've already positioned it, don't run this.
    		panel2._x = panel1._width;  // position panel2 at the end of panel 1;
    		positioned = true;          // panel2 is positioned, no need to run the postion() function anymore
    	}
    }
    }
    medyman, I thought boolean was &&,|| etc, anw its a part of as. your comments i having a little problem mostly its regarding the true& false parts

  6. #226
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    A Boolean variable is a variable that holds either a true or false value. The && and || are conditional operators.

    In other words what's happening here is that we only want to run this function once, but we're calling it multiple times. To fix this, the first time we set the positioned to true. Then within the function we say only run it if it's false. So the very first time it run the function. After that, it will not.

    Make sense now?

  7. #227
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    the first time we set the positioned to true. Then within the function we say only run it if it's false. So the very first time it run the function. After that, it will not.
    the 1st time do you mean
    Code:
    var positioned:Boolean = false;

  8. #228
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Yes.

    The position() function can only run when the positioned variable is false.

    This is the order of it

    positioned = false;
    position() function starts
    positioned = true;
    position() function is called again, but does not run because positioned = true;
    position() function is called again, but does not run because positioned = true;

    etc....

    So it only runs once!

    Is this making any sense?

  9. #229
    Join Date
    Mar 2008
    Posts
    222
    Thanks
    10
    Thanked 3 Times in 3 Posts

    Default

    okie i am slowly clearing my doubts. thanks

    its only involved the 1st 3 lines right?

  10. #230
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Yes...

    Ok, so are u ready for the next step...actually moving this thing?

Bookmarks

Posting Permissions

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