Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-02-2004, 07:24 AM   #1
Mo11
Registered User
 
Join Date: Mar 2004
Posts: 16
Default Setting dynamic image width - need help !!!

Hello all,

I've been fighting with that for a while now, I've red all I could find but nothing seems to work...
I'm sure there's something I'm missing here.

my problem :

I'm loading pics (jpg) with loadMovie into movie clips that had just been created (createEmptyMovieClip). I want to set the size of the pics after they've bee loaded.

here's the code:
PHP Code:
for (i=1;i<=myData.count;i++)
{
    
name "holder" i;
    
//create a empty movie clip for holding the Jpg pics 
    
createEmptyMovieClip(namei);
    eval(
name).loadMovie("../../images/prods/thumb/" + eval("myData.pic" i));
    eval(
name)._x 80*i;
    eval(
name)._y 120*i;
    eval(
name).onEnterFrame = function()
    {
          if (eval(
name)._width 0)
        {
            eval(
name)._width=50;
               
delete eval(name).onEnterFrame;
        }
    }    

I know you should wait for the pic to be loaded before you can acces the _width property, but I think that tha's what I'm doing ...

any help would be greatly apreciated.

Thanks in advance,

Last edited by CyanBlue; 05-02-2004 at 11:14 AM. Reason: PHP tag is applied...
Mo11 is offline   Reply With Quote
Old 05-02-2004, 07:54 AM   #2
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,579
Default

does the eval(name) bit work? try putting in some traces

also try

eval(name).onEnterFrame = function()
{
if (this._width > 0)
{
this._width=50;
delete this.onEnterFrame;
}
}
__________________
Billy
Online Galleries
iPhone Safety App - iStaySafe
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 05-02-2004, 07:58 AM   #3
Mo11
Registered User
 
Join Date: Mar 2004
Posts: 16
Default

Hey Billy T,

Thanks for your reply. I'll try to do as you suggested.

Apparently, the eval(name) works because the pictures are loading, and the positionning is well done.

The only thing I don't manage to do is to resize the pictures (the movieclip)...
Mo11 is offline   Reply With Quote
Old 05-02-2004, 08:02 AM   #4
Mo11
Registered User
 
Join Date: Mar 2004
Posts: 16
Default

just tried :
eval(name).onEnterFrame = function()
{
if (this._width > 0)
{
this._width=50;
delete this.onEnterFrame;
}
}
doesn't work ...

any other sudggestions?
Mo11 is offline   Reply With Quote
Old 05-02-2004, 08:24 AM   #5
pom
Allez les Bleus!!!
 
pom's Avatar
 
Join Date: Oct 2002
Location: Paname
Posts: 2,493
Default

You can't use the container clip as a preloader clip, because loading erases everything in your clips, including the onEnterFrame (that's my guess anyway). Try this: if I'm right, it shouldn't trace anything (if I'm wrong, I'll just go back to pottery).
Code:
for (i=1;i<=myData.count;i++)
{
	name = "holder" + i;
	//create a empty movie clip for holding the Jpg pics 
	var clip = this.createEmptyMovieClip(name, i);
	clip.loadMovie("../../images/prods/thumb/" + eval("myData.pic" + i));
	clip._x = 80*i;
	clip._y = 120*i;
	clip.onEnterFrame = function()
	{
		trace ("Hello, my name is " + this._name) ;
	  	if (this._width > 0)
		{
			this._width=50;
	  	 	delete this.onEnterFrame;
		}
	}	
}
pom
pom 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


All times are GMT. The time now is 06:54 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.