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 July 2nd, 2008, 12:21 AM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
I need help!!

Code:
class PictureSelector
{
    static var imageArray;
    function PictureSelector()
    {
    } // End of the function
    static function init()
    {
        imageArray = new Array();
		activeImage = new Array();
        imageArray = news_lv.thumbs.split("<|>");
        activeImage = news_lv.pic.split("<|>");
        for (var i = 0; i < PictureSelector.imageArray.length; ++i)
        {
            var tempMC = RightTriangles.clip.createEmptyMovieClip(PictureSelector.imageArray[i], RightTriangles.clip.getNextHighestDepth());
            tempMC.loadMovie("thumb_" + PictureSelector.imageArray[i]);
            tempMC._alpha = 30;
            tempMC._y = 100;
            tempMC._x = i * 150 + 10;
	        tempMC.thumbFile = "data/pics" + imageArray[i];
            tempMC.bigFile = "data/pics" + activeImage[i];
        } // end of for
        RightTriangles.clip.onEnterFrame = function ()
        {
            for (var i = PictureSelector.imageArray.length - 1; i >= 0; --i)
            {
                if (_root._xmouse < RightTriangles.clip[PictureSelector.imageArray[i]]._x || _root._xmouse > RightTriangles.clip[PictureSelector.imageArray[i]]._x + RightTriangles.clip[PictureSelector.imageArray[i]]._width || _root._ymouse < RightTriangles.clip[PictureSelector.imageArray[i]]._y || _root._ymouse > RightTriangles.clip[PictureSelector.imageArray[i]]._y + RightTriangles.clip[PictureSelector.imageArray[i]]._height)
                {
                    RightTriangles.clip[PictureSelector.imageArray[i]]._alpha = 30;
                    continue;
                    continue;
                } // end if
                for (var _loc3 = PictureSelector.imageArray.length - 1; _loc3 >= 0; --_loc3)
                {
                    RightTriangles.clip[PictureSelector.imageArray[_loc3]]._alpha = 30;
                } // end of for
                RightTriangles.clip[PictureSelector.imageArray[i]]._alpha = 100;
                return;
            } // end of for
        };
        RightTriangles.clip.onMouseDown = function ()
        {
            for (var i = PictureSelector.imageArray.length - 1; i >= 0; --i)
            {
                if (_root._xmouse < RightTriangles.clip[PictureSelector.imageArray[i]]._x || _root._xmouse > RightTriangles.clip[PictureSelector.imageArray[i]]._x + RightTriangles.clip[PictureSelector.imageArray[i]]._width || _root._ymouse < RightTriangles.clip[PictureSelector.imageArray[i]]._y || _root._ymouse > RightTriangles.clip[PictureSelector.imageArray[i]]._y + RightTriangles.clip[PictureSelector.imageArray[i]]._height)
                {
                    continue;
                } // end if
                RightTriangles.clip = _root.createEmptyMovieClip("gameLayer", 1);
                activeImage = PictureSelector.imageArray[i];
                RightTriangles.activeBool = true;
                RightTriangles.init();
                return;
            } // end of for
        };
    } // End of the function
    static var activeImage = "";
	static var news_lv;
	
static function Loadtxt(){
news_lv = new LoadVars();
news_lv.onLoad = function (success)
{
    if (success)
    {
        init();
    }
    else
    {
        trace ("error loading");
    } // end else if
};
news_lv.load("data/pics.txt");
init();
stop();
}
} // End of Class


This is a external.as for loading images
Do anyone of you knows where gone wrong?? the images can't be loaded.... thanks!

Reply With Quote
  #2  
Old July 2nd, 2008, 08:00 AM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 22 sec
Reputation Power: 534
Facebook MySpace
Hi, thanks for totally ignoring the How to post a question thread. Please edit your post, wrap the code in [code] tags and make sure it is formatted correctly. Re-copy and paste it from your AS file into the code tags to ensure the formatting it preserved.

Have you done anything to try finding the problem yourself? It helps if you state what you've tried to save time.

Did you put any trace statements in there to see where it's conking out?
__________________
-Tann

-Vote for your favorite ActionScript editor here.

Reply With Quote
  #3  
Old July 2nd, 2008, 09:38 AM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
thanks

sorry! I have edited the post already. I was thinking if it is the loadMovie part that it is wrong.. but i try to change the parameters a few times but it still not working.. Sorry, i am not very sure about using the trace statements but i will try it out see whether i can find anything out..

Thanks for replying! Have a nice day!

Reply With Quote
  #4  
Old July 2nd, 2008, 09:50 AM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 22 sec
Reputation Power: 534
Facebook MySpace
Heya, the first thing to do is remove the init() and stop() at the end of the Loadtxt function. Inside the onLoad event you might have to change init(); to PictureSelector.init();

Later on you have a for loop near the top of the init function. This chunk will cause you a problem:
Code:
var tempMC = RightTriangles.clip.createEmptyMovieClip(PictureSelector.imageArray[i], RightTriangles.clip.getNextHighestDepth());
tempMC.loadMovie("thumb_" + PictureSelector.imageArray[i]);
tempMC._alpha = 30;
tempMC._y = 100;
tempMC._x = i * 150 + 10;
tempMC.thumbFile = "data/pics" + imageArray[i];
tempMC.bigFile = "data/pics" + activeImage[i];

The reason for that is because when loadMovie finishes loading the image any variables/content inside the target clip is erased. That means your "thumbFile" and "bigFile" variables will be erased so you can't access them later on. An easy way to fix that is to create a new sub clip inside tempMC and load the image into there:
Code:
var tempMC = RightTriangles.clip.createEmptyMovieClip(PictureSelector.imageArray[i], RightTriangles.clip.getNextHighestDepth());

// Create  a new clip inside the old one
tempMC.createEmptyMovieClip("img", 0);

// Load into that new sub clip
tempMC.img.loadMovie("thumb_" + PictureSelector.imageArray[i]);

tempMC._alpha = 30;
tempMC._y = 100;
tempMC._x = i * 150 + 10;

// Now these can be access later
tempMC.thumbFile = "data/pics" + imageArray[i];
tempMC.bigFile = "data/pics" + activeImage[i];

Reply With Quote
  #5  
Old July 2nd, 2008, 10:15 AM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
Thanks for your quick reply!

I edited all the parts.. but the image still can't be loaded..

I was thinking can i change
Code:
            tempMC.img.loadMovie("thumb_" + PictureSelector.imageArray[i]);

to
Code:
            tempMC.img.loadMovie(tempMc.thumbFile);

So that the images(thumbnails) can be loaded
but it still can't work..

my source codes consists of 3 external.as files, a fla file for the 3 external.as to load and a data which contains the images folder(thumbnail + big pic inside) and a pics.txt.


my pic.txt consist these:

&thumbs=thumb_1.jpg<|>thumb_2.jpg<|>thumb_3.jpg&

&pic=1.jpg<|>2.jpg<|>3.jpg&

and i named my pics and thumbnail accordingly to the pic.txt names noted above..

i think this part shouldn't be wrong...

Just to let you know more about it

Again, thanks!

Reply With Quote
  #6  
Old July 2nd, 2008, 10:21 AM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 22 sec
Reputation Power: 534
Facebook MySpace
what you tried didn't work because "thumbFile" hasn't been created yet. You could try:

tempMC.img.loadMovie("data/pics" + imageArray[i]);

That's also the point you'd want to put a trace in so you can see what is being read:

trace("data/pics" + imageArray[i]);

Reply With Quote
  #7  
Old July 2nd, 2008, 10:46 AM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
Error opening URL "file:///C|/Documents%20and%20Settings/Joseph/Desktop/RightTriangle/undefined"

and it doesn't have trace("data/pics" + imageArray[i]); at the output box.

I am very sorry and i feel that i am very ridicious! But is it possible if you can look through my source? I am not good in flash but i am having attachment now who needs me to do programming.. and there's no one to help me, my in charge wants the work tomorrow and i don't know what can i do now... i am trying to figure out which part went wrong but i am not sure of it too....

I have uploaded the file into this website:
filehosting.cc/?d=BA90794D2

Thanks! It's alright if you are busy etc.. Have a nice day!

Reply With Quote
  #8  
Old July 2nd, 2008, 10:56 AM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 22 sec
Reputation Power: 534
Facebook MySpace
Step 1) Remove the constructor in the PictureSelector class i.e. delete this bit:
Code:
function PictureSelector()
    {
    } // End of the function

You don't need a constructor if you accessing all the functions statically.

Step 2) Comment out all the XML related code in the main fla. It doesn't seem to be used anyhow.

Step 3) Inside RightTriangles.as change PictureSelector.init(); to PictureSelector.Loadtxt();

Step 4) Inside PictureSelector.as change:
Code:
tempMC.img.loadMovie("data/pics/thumb_" + imageArray[i]);

to:
Code:
tempMC.img.loadMovie("data/pics/" + imageArray[i]);


That's all you have to do to get the images to load.
Comments on this post
happinessclover agrees: Thanks! Very clear and helpful instructions!

Reply With Quote
  #9  
Old July 2nd, 2008, 12:00 PM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
Thanks it works!

however, the big picture can't be loaded out.. it's when you click on the thumbnail a big pic can be loaded and the pic can be zoom and rotated..
the output box said
Error opening URL "file:///C|/Documents%20and%20Settings/Joseph/Desktop/RightTriangle2/thumb_1.jpg"

i tried changing
Code:
 RightTriangles.clip = _root.createEmptyMovieClip("gameLayer", 1);

                activeImage = PictureSelector.imageArray[i];
                RightTriangles.activeBool = true;
                RightTriangles.init();
                return;

to
Code:
 RightTriangles.clip = _root.createEmptyMovieClip("gameLayer", 1);
				RightTriangles.clip.loadMovie("data/pics/" + activeImage[i];)
                activeImage = PictureSelector.imageArray[i];
                RightTriangles.activeBool = true;
                RightTriangles.init();
                return;

but it can't work.. it has lot's of errors. is that the correct place to put RightTriangles.clip.loadMovie("data/pics/" + activeImage[i]); ??

Reply With Quote
  #10  
Old July 2nd, 2008, 02:18 PM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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: 7835 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 h 57 m 22 sec
Reputation Power: 534
Facebook MySpace
The code you posted says:
Code:
RightTriangles.clip.loadMovie("data/pics/" + activeImage[i];)

Which should be:
Code:
RightTriangles.clip.loadMovie("data/pics/" + activeImage[i]);
Comments on this post
VisseAUS agrees: Good help Tann
happinessclover agrees: thanks!

Reply With Quote
  #11  
Old July 2nd, 2008, 06:25 PM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
thanks! It works..
Thanks! alot!
I am now trying to enable dragging before the the movie enter to the big pic frame.... thanks for helping!

Reply With Quote
  #12  
Old July 3rd, 2008, 10:33 AM
happinessclover happinessclover is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 20 happinessclover User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 23 m 37 sec
Reputation Power: 0
Hi! I am now adding a drag function to allow dragging of the thumbnail images.. and after double click of the image, it will enter the big photo which allows rotation and zooming of the big pic.

I came out with a script like this
Code:
		static function drag()
{
    if (RightTriangles.clip.onEnterFrame)
    {
        tempMC.startDrag();
    } // end if
    if (!tempMC.click)
    {
        tempMC.click = true;
        tempMC.timer = getTimer() / 1000;
    }
    else
    {
        tempMC.timer2 = getTimer() / 1000;
        if (tempMC.timer2 - tempMC.timer < 2.500000E-001)
        {
             
            for (var i = PictureSelector.imageArray.length - 1; i >= 0; --i)
            {
                if (_root._xmouse < RightTriangles.clip[PictureSelector.imageArray[i]]._x || _root._xmouse > RightTriangles.clip[PictureSelector.imageArray[i]]._x + RightTriangles.clip[PictureSelector.imageArray[i]]._width || _root._ymouse < RightTriangles.clip[PictureSelector.imageArray[i]]._y || _root._ymouse > RightTriangles.clip[PictureSelector.imageArray[i]]._y + RightTriangles.clip[PictureSelector.imageArray[i]]._height)
                {
                    continue;
                } // end if
                RightTriangles.clip = _root.createEmptyMovieClip("gameLayer", 1);
                activeImage = PictureSelector.imageArray[i];
                RightTriangles.activeBool = true;
                RightTriangles.init();
                return;
				
            } // end of for
        };
    } // End of the function
        }
        else
        {
            tempMC.timer = getTimer() / 1000;
            tempMC.click = true;
        } // end else if
    } // end else if
    tempMC.swapDepths(_root.getNextHighestDepth());
} // End of the function	

but it doesn't work.. Do you know where did i get it wrong so i can look into it? thanks!!
I added this script after line 62 in pictureSelector.as.

THANKS AGAIN!

Reply With Quote
  #13  
Old July 3rd, 2008, 10:39 AM
Tann San Tann San is offline
Gotta get to the next screen..
Click here for more information.
 
Join Date: Nov 2003
Location: Legion of Dynamic Discord
Posts: 4,584 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)