Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-09-2006, 10:01 PM   #1
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default scrollPane help!

I am having trouble adding drag properties to items I load into my Room scrollpane. Additionally, how do I determine what Item I clicked on? I am loading external swf into the Room scrollpane via an XML menu. Ultimately, i would like to add a drag and rotate function, but for now I'll be satisfied just draging the items I add. Everything works except the drag part.

Here is my code, thanks for any help.

ActionScript Code:
var myXML:XML = new XML(); myXML.ignoreWhite = true; libraryList_ar = new Array(); combo_list.dataProvider = libraryList_ar; myXML.onLoad = function(success) {  if (success) {   //trace(this);      var libraries = this.firstChild;   var dValue = this.firstChild.attributes.name;   //trace(dValue);   combo_list.textField.label.text = "Library";   var libCount = libraries.childNodes.length;   trace(libCount);   var libItems = libraries.firstChild.childNodes.length;   //trace(libItems);      for (var i = 0; i<libCount; i++) {    //libraryList_ar[i] = libraries.childNodes[i].childNodes[0].firstChild.nodeValue;    libraryList_ar[i] = new Object();    libraryList_ar[i].label = libraries.childNodes[i].attributes.Text;    libraryList_ar[i].data = libraries.childNodes[i];    //save reference here   }  } }; myXML.load("itemMenu.xml"); // loading_txt.autoSize = true; loading_txt.text = ""; loading_txt._visible = false; // resize loading images to thumbnail size var MAX_WIDTH:Number = 50; var MAX_HEIGHT:Number = 50; // var mcl:MovieClipLoader = new MovieClipLoader(); var mclListener:Object = new Object(); mclListener.onLoadInit = function(mc:MovieClip) {  loading_txt.text = "Loading...";  // set variables to keep the original image dimensions  var xw = mc._width;  var xh = mc._height;  //  // where image width is greater than image height  if (mc._width>mc._height) {   mc._width = MAX_WIDTH;   mc._height = (mc._height*MAX_WIDTH)/xw;   // center image   mc._y = (75-mc._height)/2;  }  //where image height is greater than image width  if (mc._height>mc._width) {   mc._height = MAX_HEIGHT;   mc._width = (mc._width*MAX_HEIGHT)/xh;   mc._x = (75-mc._width)/2;  }  //  loading_txt._visible = false; }; // _global.count = 0; // combo_list.change = function(eventObj) {  thumbs.invalidate();  thumbs.refreshPane();  //  var selItem:Object = eventObj.target.selectedItem;  //trace("Item selected was:  "+selItem.label);  var itemXML:XMLNode = selItem.data;  //use saved reference to iterate through childNodes  for (var idx = 0; idx<itemXML.childNodes.length; idx++) {   trace("Item includes: "+itemXML.childNodes[idx].attributes.Text);   var t_mc:MovieClip;   t_mc = thumbs.content.attachMovie("thumb_mc", "thumb"+idx, idx, this.getNextHighestDepth());   t_mc._x = 5;   t_mc._y = 5+(idx*80);   //this loads the swf into the thumbs scrollPane   _root["mc"+idx] = new MovieClipLoader();   _root["mc"+idx].addListener(mclListener);   _root["mc"+idx].loadClip(itemXML.childNodes[idx].attributes.ItemSWF, t_mc.Container_mc);   //_root["mc"+idx].loadClip("decals/"+ItemSWF+".swf", t_mc.Container_mc);   //   t_mc.idx = idx;   t_mc.piece = itemXML.childNodes[idx].attributes.ItemSWF;   //        t_mc.onRelease = function() {    //trace(this.now)     // this adds the item to the room    var tmp:MovieClip = room.content.createEmptyMovieClip("myLoader"+count, count+100);    count++;    mcl.loadClip("decals/"+this.piece+".swf", tmp);    tmp._x = 100;    tmp._y =100;    room.invalidate();    //trace("tmp= "+tmp);    _global.temp_mc = tmp;   };  } }; combo_list.addEventListener("change", combo_list); // add draging room.temp_mc.onPress = function() {  this.startDrag(); }; room.temp_mc.onRelease = function() {  this.stopDrag(); };
__________________
Damn the torpedoes! Full speed ahead.

Last edited by Navarone; 10-11-2006 at 02:37 PM. Reason: not getting any help
Navarone is offline   Reply With Quote
Old 10-10-2006, 11:58 AM   #2
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

Well I worked with this all night and still haven't found a way to drag my movieClips once there loaded into the scrollPane, any ideas?
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 10-10-2006, 02:00 PM   #3
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

ok, I got my drag function to work with this code
ActionScript Code:
// room.content.onPress = function() {      this.startDrag(); }; room.content.onRelease = function() {     stopDrag(); };

but a strange thing is happening. If I drag an item in my room to the corner and then add a new item, both items end up in the original start location overlaping one another and then drag as one object.

What am I doing wrong?
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 10-10-2006, 02:51 PM   #4
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

ok, I mangaged to get the items seperated by adding the temp_mc to the drag properties.
ActionScript Code:
room.content.onPress = function() {     temp_mc.startDrag(); }; room.content.onRelease = function() {     temp_mc.stopDrag(); };

now, I can add multiple items, but I can only drag the last item added to the scrollPane, I don't know what I am doing wrong, anybody?
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 10-10-2006, 05:38 PM   #5
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

Hey I must of stumped even the guru's

I can't come up with anything as yet.
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 10-11-2006, 02:36 PM   #6
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default scrollPand help

Can anyone help me with this. I just can't get it.
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd Timeline Transition Error Benaiah Other Flash General Questions 1 08-01-2006 04:32 PM
adding a sound to drag n drop ub_flash Simple Stuff (Newbies) 4 10-11-2005 11:55 AM
adding new properties to movieclip instances? Flippie124 ActionScript 2.0 7 02-23-2005 07:09 PM
adding properties to an object Flippie124 ActionScript 2.0 3 02-01-2005 12:54 PM
adding custom properties to a button jabberwo ActionScript 1.0 (and below) 1 01-06-2005 10:19 PM


All times are GMT. The time now is 07:15 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.