Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 14th, 2004, 03:09 PM
skezo skezo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 74 skezo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 12 sec
Reputation Power: 5
duplicate and drag empty mc

Could someone please help I am going crazy!! I am connecting to a php file then it retrieves data from a mySQL database then flash presents it. This all works great. But here is the problem I want to then be able to duplicate the data (which is images). Please view the code below, I have tried many different ways but nothing seems to work. Any help would be greatly appreciated!!!
Thank you
skezo

Code:
userData = new LoadVars();
userData.load("testme.php");
userData.ref = this;
offset = 60;
userData.onLoad = function(succes) {
	if (succes) {
		for (var i = 0; i<this.cant; i++) {
		this.ref.createEmptyMovieClip("clip_"+i, i);
		this.ref["clip_"+i].createEmptyMovieClip("holder_"+i, i);
		this.ref["clip_"+i]["holder_"+i].loadMovie(this["Image"+i]);
		this.ref["clip_"+i]._yscale = 40;
		this.ref["clip_"+i]._xscale = 40;
		this.ref["clip_"+i].onPress = function() {
			duplicateMovieClip(this, "mc"+i, 500+i);
			startDrag("mc"+i);
			};
		this.ref["clip_"+i].onRelease = function() {
				stopDrag();
			};
		if (i != 0) {
			this.ref["clip_"+i]._y = this.ref["clip_"+(i-1)]._y+this.ref["clip_"+(i-1)]._height+offset;
			}
		}
	} else {
		trace("Something is wrong!!!");
	}
};
stop();

Reply With Quote
  #2  
Old February 14th, 2004, 06:29 PM
Tann San Tann San is online now
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,718 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 57 m 54 sec
Reputation Power: 580
Facebook MySpace
Hi, I don't think that will work. Duplicating will not copy the image as well, you must assign it again:
Code:
   
this.ref["clip_"+i]["holder_"+i].loadMovie(this["Image"+i]);
this.ref["clip_"+i]._yscale = 40;
this.ref["clip_"+i]._xscale = 40;
this.ref["clip_"+i].onPress = function() 
   {
      newOne = duplicateMovieClip(this, "mc"+i, 500+i);
      newOne.loadMovie(this["Image"+i]);
      newOne._yscale = 40;
      newOne._xscale = 40;
      newOne.startDrag();
   };
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
  #3  
Old February 14th, 2004, 06:51 PM
skezo skezo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 74 skezo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 12 sec
Reputation Power: 5
Hi Tann, thanks for the reply i tried what you have suggested but still not duplicating the image it is driving me crazy! In theory it should work but nothing
if you have time check this address http://www.aburningwater.com/testme1.html

Reply With Quote
  #4  
Old February 15th, 2004, 07:35 AM
skezo skezo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 74 skezo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 12 sec
Reputation Power: 5
This is very frustrating; this is what I have done so far (also including the code from my first post)

When I add loadMovie(this["Image"+i]); instead of loadMovie("image1.jpg"); it does not work, can anyone see a fix to this, example of it can be found here: http://www.aburningwater.com/testme1.html

Code:
this.ref["clip_"+i].onPress = function() {
				_root.createEmptyMovieClip("mc"+i, i+500);
				_root["mc"+i].createEmptyMovieClip("holdme"+i, i+600);
				_root["mc"+i]["holdme"+i].loadMovie("image1.jpg");
				_root["mc"+i]._yscale = 40;
				_root["mc"+i]._xscale = 40;
				_root["mc"+i].startDrag();
				_root["mc"+i].onPress = function() {
					_root["mc"+i].startDrag();
				}
			};

Reply With Quote
  #5  
Old February 15th, 2004, 09:20 AM
Tann San Tann San is online now
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,718 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 57 m 54 sec
Reputation Power: 580
Facebook MySpace
Hi, I've got a few ideas as to what may be going wrong..it could take a while though going backwards and forwards here. Can you post a link or attach a zip of the .fla in MX format. I'll take a look today and get back to you.

Reply With Quote
  #6  
Old February 15th, 2004, 09:38 AM
skezo skezo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 74 skezo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 12 sec
Reputation Power: 5
Hi Tann, thanks again for the reply.
Attached Files
File Type: zip testme3.zip (5.7 KB, 91 views)

Reply With Quote
  #7  
Old February 15th, 2004, 10:29 AM
Tann San Tann San is online now
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,718 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 57 m 54 sec
Reputation Power: 580
Facebook MySpace
Hi, I copied your php output to a text file. I had to add &cap=capped to the end to get the loop to read the number "cant" correctly. This is the updated and working code:
Code:
offset = 60;
globalCount = 5;
myData = new LoadVars();
myData.load("testme.txt");
myData.ref = this;
myData.onLoad = function(succes) {
	if (succes) {
		for (var i = 0; i<Number(this.cant); i++) {
			this.ref.createEmptyMovieClip("clip_"+i, i);
			this.ref["clip_"+i].createEmptyMovieClip("holder_"+i, i);
			this.ref["clip_"+i]["holder_"+i].loadMovie(this["Image"+i]);
			this.ref["clip_"+i]._yscale = 40;
			this.ref["clip_"+i]._xscale = 40;
			this.ref["clip_"+i].onPress = function() {
				_root.globalCount++;
				blankOne = _root.createEmptyMovieClip("mc"+_root.globalCount, _root.globalCount);
				newClicker = blankOne.createEmptyMovieClip("holdme1", 1);
				trace(_root.globalCount);
				newClicker.loadMovie(_root.myData["Image"+this.getDepth()]);
				blankOne._yscale = 40;
				blankOne._xscale = 40;
				blankOne.startDrag();
				blankOne.onPress = function() {
					this.startDrag();
				};
			};
			this.ref["clip_"+i].onMouseUp = function() {
				stopDrag();
			};
			if (i != 0) {
				this.ref["clip_"+i]._y = this.ref["clip_"+(i-1)]._y+this.ref["clip_"+(i-1)]._height+offset;
			}
		}
	} else {
		trace("Something is wrong!!!");
	}
};
stop();

Reply With Quote
  #8  
Old February 15th, 2004, 11:54 AM
skezo skezo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 74 skezo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 12 sec
Reputation Power: 5
Tann you are a King among men, thank you very much, it has been an educational roller coaster. Just a quick question why did you need to add &cap=capped to the text file? i have not touched my php file and it seems to work.. But thank you again!!!!

-skezo

Reply With Quote
  #9  
Old February 15th, 2004, 12:41 PM
Tann San Tann San is online now
Gotta get to the next screen..
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,718 Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)Tann San User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 11326 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 1 Day 12 h 57 m 54 sec
Reputation Power: 580
Facebook MySpace
Hi, oh that's just for the text file. Sometimes flash has trouble telling when the end of the line is. I think it depends on what os you write the text file. With a php file you shouldn't have a problem. Without the extra (non used) variable flash might read "cant=3\r\n" or some variant (maybe..!?..) so it wont work in a loop correctly. I'm not too sure if Number(cant) will make ignore the extras or not so I do it anyway for now. I kind of left text files for a while in favor of php and xml so I havent really bothered to experiment, maybe I will now though :¬)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > duplicate and drag empty mc


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT