I need to scroll dynamic created mc's

Hi there,

I need some suggestion how to adjust the following to allow it to scroll:

Right now i have created dynamic mc’s with

 .createEmptyMovieClip ("mc" + child, child);

the resulting mc’s have a textField and a bg attach to them


.createTextField ("txt", child + 1, 1, 1, 200, 35);
.attachMovie ("txtBG", "txtBG" + child, 0);

what i have got now are different buttons on the stage. So far so good.

There will be more buttons in the future so i need to scroll the dynamic created mc’s. HOw do i do this??

I was thinking of creating a empty mc and this mc will hold the dynamic created mc’s. Furthermore, i would use a mask, a moveUp button and a moveDown button.

My question:
Should i use AS to produce the empty mc and the mask? Or movie instances??

Any other suggestions are also welcome ofcourse

Yup i guess i’d do the same. Use a master container that will hold everything and have that scrolled, with the use of masks. I dont think it matters really which way you do it, if your competent enough do it in action script.

Regards,
Viru.

Oke

That is the way i am trying it now. One of the things that goes wrong is the _heigth of the holder, i think.

I found this AS i want to use for the up & down


//prototype function for scrolling up button
MovieClip.prototype.moveUp = function() {
	//when it enters the frame
	this.onEnterFrame = function() {
		//if myClip is less than or equal to howFarUp
		if (myClip._y>=howFarUp) {
			//delete the onEnterFrame so it can't scroll anymore
			delete this.onEnterFrame;
		} else {
			//else keep scrolling it
			myClip._y += speed;
		}
	};
};

//prototype function for down button
MovieClip.prototype.moveDown = function() {
	//when it enters the frame
	this.onEnterFrame = function() {
		//if myClip._y less than or equal to howFarDown
		if (myClip._y<=howFarDown) {
			//delete the onEnterFrame so it can't scroll
			delete this.onEnterFrame;
		} else {
			//else keep scrolling it
			myClip._y -= speed;
		}
	};
};

in my case i made myClip a empty mc that holds the dynamic created mc’s.
When i change


myClip._y<=howFarDown 

to


myClip._y>=howFarDown 

it scrolls down but i can see the logic in that and futhermore the up does nothing.

:slight_smile: k, i’ll explain the logic with a bit a paper. Take a piece of paper (news paper or something with text on it). Now pretend theres a mask over it, say a 6cm square in the centre. Now if you want to see whats above the mask you need to pull the paper down, and if you want to see whats below the mask you need to pull the paper up. Right?

So thats why moveDown has a -= becuase you need to move up the Y axis, remember moving up the Y axis in Flash is actually decresing the Y axis. Does that make sense?

Trust me though the logic in the script it right. And as for moveUp doing nothing its probably cos the value of howFarUp is less than the value of your movieclip at coordinate Y.

Viru.

thnks for the explanation gonna dive into it

I get it with a simple static mc that’s bigger then a mask and scrolling it. But with dyn. create mc’s in a holder i don’t get it! Well i get the logic but i can get it to work correctly

Any more suggestions.

What are you trying to do that doesnt work correctly?

the scrolling part. When changing the prototypes it kind of works. But not according to the logic

maybe you could take a peek

i used this portfolio.xml


<PORTFOLIO>
  <PICTURE NAME="Client 1" THUMB=""  IMAGE="portfolio_images/image1.jpg" /> 
  <PICTURE NAME="Client 2" THUMB=""  IMAGE="" /> 
  <PICTURE NAME="Client 3" THUMB="" IMAGE="portfolio_images/image3.jpg" />
  <PICTURE NAME="Client 4" THUMB=""  IMAGE="image2.jpg" /> 
  <PICTURE NAME="Client 5" THUMB=""  IMAGE="image3.jpg" />
<PICTURE NAME="Client 6" THUMB="" IMAGE="portfolio_images/image1.jpg" /> 
  <PICTURE NAME="Client 7" THUMB="" IMAGE="" /> 
  <PICTURE NAME="Client 8" THUMB="" IMAGE="portfolio_images/image3.jpg" />
  <PICTURE NAME="Client 9" THUMB="" IMAGE="image2.jpg" /> 
  <PICTURE NAME="Client 10" THUMB=""IMAGE="image3.jpg" />  
<PICTURE NAME="Client 11" THUMB=""  IMAGE="portfolio_images/image1.jpg" /> 
  <PICTURE NAME="Client 12" THUMB="" IMAGE="" /> 
  <PICTURE NAME="Client 13" THUMB="" IMAGE="portfolio_images/image3.jpg" />
  <PICTURE NAME="Client 14" THUMB="" IMAGE="image2.jpg" /> 
  <PICTURE NAME="Client 15" THUMB="" IMAGE="image3.jpg" />    
</PORTFOLIO>