A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: attchMoive inside scrollPane?

  1. #1
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    CFA2h (respect the HEX)

    attchMoive inside scrollPane?

    Im having trouble trying to get my attached Clips to scroll (vertically)

    My project so far just loads an XML object...loops through the data and populates EACH dynamically attachedClip

    I tried to use a scrollPane component..but I havent been able to get ANY movies to attach inside....

    I also tried using a scrollbar of my OWN.....but it doesnt scroll correctly. I believe the problem to be..that the onLoad of the scrollBar code that gets the initial length of the clip to be scrolled is NOT getting the correct length because the attachedClips are NOT populating in the clip before this variable is set. (needs to be a set length at authoring time to work correctly)

    here is the code I have... everything works PERFECTLY, everything is populating with the correct data..all clips (total) are being attached correctly form the XML file. I just nned to have all this happen INSIDE a clip that I cna scroll.. open to ideas & suggestions?



    import mx.utils.Delegate;
    var mc:MovieClip = this;
    var rootNode:XMLNode;
    var productsNode:Array;
    var totalProducts:Number;
    var myXML_xml = new XML();
    myXML_xml.ignoreWhite = true;
    myXML_xml.onLoad = Delegate.create(this, getTotalProducts);
    function getTotalProducts(success):Void {
    if (success == true) {
    rootNode = myXML_xml.firstChild;
    productsNode = rootNode.childNodes;
    totalProducts = rootNode.childNodes.length;
    this.onEnterFrame = Delegate.create(this, function() {
    delete this.onEnterFrame;
    ); //end Delegate
    } else {
    trace("Load Failed");
    function createTemplates():Void
    for (i = 0; i < totalProducts; i++) {
    var attachProduct:MovieClip = attachMovie("templateClip", "product" + i, i);
    attachProduct._x += i * 220;
    attachProduct._y += 40;
    function populateAll():Void {
    for (i = 0; i < totalProducts; i++) {
    var totalSizes:String =productsNode[i].childNodes[3].childNodes.length;
    var totalColors:String =productsNode[i].childNodes[4].childNodes.length;
    trace("product"+i+" totalSizes: "+totalSizes);
    trace("product"+i+" totalColors: "+totalColors);
    var prodName:String = productsNode[i].childNodes[1].firstChild.nodeValue;
    var obj = this["product" + i];
    obj.name_txt.text = prodName;
    trace("Name: "+prodName);
    var prodImage:String = productsNode[i].childNodes[0].firstChild.nodeValue;
    var prodLink:String = productsNode[i].childNodes[6].firstChild.nodeValue;
    var obj = this["product" + i];
    obj.prodImage_container.innerContainer_mc.loadMovi e("clothing/"+prodImage);
    obj.linkVar = prodLink;
    trace("Image: "+prodImage);
    trace("URL: "+prodLink);
    var prodPrice:String = productsNode[i].childNodes[2].firstChild.nodeValue;
    var obj = this["product" + i];
    obj.price_txt.text = prodPrice;
    trace("Price: "+prodPrice);
    var prodDesc:String = productsNode[i].childNodes[5].firstChild.nodeValue;
    var obj = this["product" + i];
    obj.desc_txt.text = prodDesc;
    trace("Description: "+prodDesc+newline);
    for (x = 0; x < totalSizes; x++) {
    var size:String = productsNode[i].childNodes[3].childNodes[x].firstChild.nodeValue;
    var obj = this["product" + i];
    for (y = 0; y < totalColors; y++) {
    var color:String = productsNode[i].childNodes[4].childNodes[y].firstChild.nodeValue;
    var obj = this["product" + i];

    NONE of this code can change except maybe some pathing.

    Im NOT against using the scrollPane..but would rather use my own....

    here is one I made..with a custom scrollBar..however the attachedClips DO NOT populate in time for the scrollbar to work correctly..

    (you can test this by deleting the text & yellowBG inside the objectClip)..it wont scroll the correct way...if there IS something in there at authoring time..it will use that as the length to scroll by.



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