PDA

View Full Version : attachMovie inside a scrollPane?


whispers
04-10-2006, 09:43 PM
Id rather NOT use the scrollPane (and use my own custom easy to use scrollbar) but if I have to.....I have to :(

basically my project loads up my XML object..and attaches as many clips to the stage as needed. It then looops through the data to populate each of these attachedClip with the corretc data... all that is fine, all comboBox = OK!..etc..

However...I need to be able to SCROLL these as my ultimate goal. right now they are just being attached to _root.

I have NOT been able to get the scrollPane to to do much of anything... it may attach/load 1 clip from the library (as set from linkage)..but thats about it...not populated..and not more than 1 attachedClip.

scrollPane = KAKA

I have since moved to one of my own custom scollBars (that just scrolls ANY content inside of a predetermined clip)...

The problem I have found with this..is that..onLoad..the scrollbar checks for inital values to use as its parameters....

Hence..NOT enough time to populate the scrolled Clip........

the attached .zip is where I am at now. It does NOT take into account the objectClips' (clip to be scrolled) height AFTER the the attachedClips have been created.

if you test it..it will scroll correctly...however..NOT scroll enouh to see all the dynamically attachedClips.... it is going off the CONTENT already in the clip at authoring time (the textField and the YellowBG fill)...if you delete these...and test..you will see it does NOT scroll correctly..

anybody got any ideas? Thanks

www.dmstudios.net/XML_scrollTest.zip

Xeef
04-10-2006, 10:31 PM
your upload is incomplet ! missing "products.xml"

not sure why you don't like the scrollpane ???


//put a scrollpane and an Empty symbol whit linkage "Empty" in the library
_root.createClassObject(mx.containers.ScrollPane, "SP", 0);
//
SP.contentPath = "Empty";
SP.content.createEmptyMovieClip("0", 0);
ML = new MovieClipLoader();
ML.List = [];
ML.List[0] = "http://www.helpexamples.com/flash/images/image1.jpg";
ML.List[1] = "http://www.w3.org/Icons/w3c_main.png";
ML.List[2] = "http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg";
ML.List[3] = "http://www.helpexamples.com/flash/images/image1.jpg";
ML.List[4] = "http://www.w3.org/Icons/w3c_main.png";
ML.List[5] = "http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg";
ML.X = ML.Y=ML.MaxY=0;
ML.onLoadInit = function(_mc) {
_mc._xscale = _mc._yscale=40;
_mc._x = this.X;
_mc._y = this.Y;
if (this.MaxY<_mc._height) {
this.MaxY = _mc._height;
}
this.X += _mc._width+5;
if (this.X>200) {
this.X = 0;
this.Y += this.MaxY+5;
this.MaxY = 0;
}
Nr = Number(_mc._name)+1;
if (this.List[Nr]) {
_root.SP.content.createEmptyMovieClip(String(Nr), Nr);
this.loadClip(this.List[Nr], _root.SP.content[Nr]);
}
SP.setSize(200, 200);
};
ML.loadClip(ML.List[0], SP.content["0"]);

whispers
04-11-2006, 05:11 AM
Hi..thanks for the reply...sorry I forgot the XML file..

here is the file I have been working on for HOURS (literally... :(

I am NOT using the scrollPane component... am using a scrollBar (mc) that scrolls the contents of a "specified" movieClip....

its uses the "length" of the movieClip in the properties to know how much it needs to scroll compared to the constraints the startDrag has...

here is the .zip if you want to take a look (please)

www.dmstudios.net/scrollingAttachedClips.zip

The problem I am having is this:

I have to have something INSIDE the movieClip (put there @ authoring time) that gets populated with all the attached movieClips to actually give the clip "length" so the scrollBar can scroll it... where as it should be taking the height of the clip AFTER the all the attachedClips are created... the scrollBar properties are get instatiated before the attachedClsip are being created.

How can I fix this?

look at the file...test it...works fine (except doesnt scroll far enough..becuase on using the length of the clip&text..if you delete the BG and the text..layers...then text you will see the problem there as well..



thanks

Xeef
04-11-2006, 02:12 PM
thiswillnearly fix it


onClipEvent (enterFrame) {
var movement:Number = (_parent.objectClip._height-_parent.length_mc._height)/(_parent.length_mc._height);
_parent.objectClip._y = (_parent.sliderClip._y-sliderClip_y)*-movement+objectClip_y;
}

not realy wana go depher in to it ! there is still a rest of ca 30-40 pixels outside ?!

whispers
04-11-2006, 04:40 PM
thiswillnearly fix it


onClipEvent (enterFrame) {
var movement:Number = (_parent.objectClip._height-_parent.length_mc._height)/(_parent.length_mc._height);
_parent.objectClip._y = (_parent.sliderClip._y-sliderClip_y)*-movement+objectClip_y;
}

not realy wana go depher in to it ! there is still a rest of ca 30-40 pixels outside ?!

Thanks for the reply...

Yeah I see what you mean... hmm.. I wonder why that is??? I cant believe it has been this hard to populate a scrollingClip with attachedClips...


onClipEvent (enterFrame) {
var movement:Number = ((_parent.objectClip._height+35)-_parent.length_mc._height)/(_parent.length_mc._height);
_parent.objectClip._y = (_parent.sliderClip._y-sliderClip_y)*-movement+objectClip_y;
}



this is what I used to add some padding....however this defeats the purpose of ONLY being able to update by XML alone..you need flash to always edit this "padding" amount..

:( not happy. grrr.. anyone else know how I can accomplish possibly?

Thanks :)

mary_ftech
09-07-2006, 07:43 AM
hi

iam also having the doubt in this topic

how we use the onrelease in scrollpane movieclip..????????

mary_ftech
09-07-2006, 07:46 AM
hi

how we use the onrelease function in sp.content[0].onrelease send me example

sleekdigital
09-07-2006, 02:11 PM
I have some code that works much like what is discussed in this thread. You can get teh source code here..
http://www.sleekdigital.com/News/5.aspx