-
This makes no sense to me
I have a MC with the instance of "bar" which hold a blank MC with the instance of "pic"
that I want to load with an image located in a foldeer called "images".
This works:
while (n <= num) {
duplicateMovieClip(bar, "bar" + n, n);
newClip = "bar" + n;
trace(newClip);
ystart = GetProperty(bar,_y) ;
setProperty(newClip, _y, ystart + n*300);
loadMovie("images/Image1c.jpg",bar1.pic);
n = n + 1;
trace(n);
}
This does not:
while (n <= num) {
duplicateMovieClip(bar, "bar" + n, n);
newClip = "bar" + n;
trace(newClip);
ystart = GetProperty(bar,_y) ;
setProperty(newClip, _y, ystart + n*300);
loadMovie("images/Image1c.jpg",newClip.pic);
n = n + 1;
trace(n);
}
Anyone have a clue as to why?
Toby
Best regards
Toby Mack
For the best and funniest Audio Blog on the Internet come visit:
http://feeds.feedburner.com/Fla****UpBlog
-
OOP is one letter from OOPS
I am guessing because newClip = "bar" + n; is simply a string (or some other object) and not a reference to the new movieclip.
-
I understand it is a string but if a string is not accepted here then why would it be acceptable in this line of code:
setProperty(newClip, _y, ystart + n*300);
I amstill confused.
Toby
Best regards
Toby Mack
For the best and funniest Audio Blog on the Internet come visit:
http://feeds.feedburner.com/Fla****UpBlog
-
OOP is one letter from OOPS
try:
newClip = duplicateMovieClip(bar, "bar" + n, n);
-
Nope. Isn't there a prefix that needs to in front of newClip ? Something like
MovieClip:newClip ?
Toby
Best regards
Toby Mack
For the best and funniest Audio Blog on the Internet come visit:
http://feeds.feedburner.com/Fla****UpBlog
-
OK here is what I found. You have to fool flash into thinking "newClip" is a real MC.
while (n <= num) {
duplicateMovieClip(bar, "bar" + n, n);
newClip = "bar" + n;
trace(newClip);
ystart = GetProperty(bar,_y) ;
setProperty(newClip, _y, ystart + n*300);
this[newClip].pic.loadMovie("images/Image1c.jpg");
n = n + 1;
trace(n);
}
The answer is:
this[newClip].pic.loadMovie("");
Best regards
Toby Mack
For the best and funniest Audio Blog on the Internet come visit:
http://feeds.feedburner.com/Fla****UpBlog
-
OOP is one letter from OOPS
this[newClip] is called an eval (I think) it converts whatever is in to an object reference. Still not sure why the other way did not work, but hey looks you got it working anywauy.
-
There are so many things to learn in flash. Now I understand Actionscript 3 is going to be a new learning cure again. Mercy.
Toby
Best regards
Toby Mack
For the best and funniest Audio Blog on the Internet come visit:
http://feeds.feedburner.com/Fla****UpBlog
-
OOP is one letter from OOPS
yeah just starting AS3 now. Looks pretty powerful, but there are some syntaxs that exists in as2 that just are not there in AS3 (e.g., duplicateMovieClip btn.onRelease= function()).
I have a feeling that once you get used to it, it is going to allow you to do things that AS2 would make pretty tricky.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|