Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6659153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:59:55+00:00 2026-05-26T01:59:55+00:00

I had written this code out using Adobe CS3 and have recently upgraded to

  • 0

I had written this code out using Adobe CS3 and have recently upgraded to CS5. I haven’t touched this site in forever and the last time that I did it worked great. The problem is as follows.

type of page: gallery
problem: passing variables

this is the original code that worked last time I checked it but has since stopped working.

function onClick(e:MouseEvent):void
    {
            trace(e.currentTarget.name);
            loadPics(e.currentTarget.name);
    }

This is the onClick function. The great thing is that the trace spits out the correct path to the photo. The problem happens in the loadPics() function. As you can see I’m passing the same path (the one that prints to screen correctly) to the function. here’s the code for the function, I apologize if it’s a bit messy.

function loadPics(pic):void
{
    photoLoader.source = pic;
    photoLoader.y = 10;
    photoLoader.x = 10;
    loaderHolder.addChild(photoLoader);
    //trace (pic.name) yields nothing
    //trace (photoLoader.source.name) yields nothing
    //trace (photoLoader.name) yields the default instanceXX name
    if(photoLoader.source.width > photoLoader.source.height)
    {
            trace("landscape");
    }
    else if(photoLoader.source.width < photoLoader.source.height)
    {
    trace("portrait");
    }
    else
    {
            trace("fail");
    }

    //draw loader background
    loaderHolder.graphics.beginFill(0xffffff, 1);
    loaderHolder.graphics.drawRect(0, 0, photoLoader.source.width + 20,                photoLoader.source.height + 20);
    loaderHolder.graphics.endFill();
    loaderHolder.x = 230;
    loaderHolder.y = 70;
    this.addChild(loaderHolder);
}

Please shed some light on this issue. My thumbnails load great, and all the paths are correct. The error that spits out when I click a thumbnail is this

ReferenceError: Error #1069: Property name not found on String and there is no default value.
at portfolio_fla::MainTimeline/loadPics()
at MethodInfo-379()

So I’m deducing that the correct file isn’t being loaded because no file is being loaded at all. Is there a disconnect between the argument I’m passing and the fact that loadPic isn’t reading it as a string? Please help!

Oops almost forgot here are my declarations for the holders

var loaderHolder:Sprite = new Sprite();
var photoLoader:UILoader = new UILoader();

This is the error the debugger outputs when I load the movie

Attempting to launch and connect to Player using URL C:\Documents and Settings\Brodie\Desktop\stephTsai\portfolio.swf
[SWF] C:\Documents and Settings\Brodie\Desktop\stephTsai\portfolio.swf – 426245 bytes after decompression

This is the error the debugger outputs when I click a thumbnail button

gallery/large/test1.jpg
ReferenceError: Error #1069: Property width not found on String and there is no default value.
at portfolio_fla::MainTimeline/loadPics()[portfolio_fla.MainTimeline::frame1:45]
at Function/portfolio_fla:MainTimeline/loadThumbs/portfolio_fla:displayThumbs/portfolio_fla:onClick()[portfolio_fla.MainTimeline::frame1:163]

That first part ‘gallery/large/test1.jpg’ is the program tracing the path at the end of the loadThumbs() function… I’m so lost and I apologize if the code/methodology is weird but I haven’t touched actionscript in forever.

(EDIT—————————————————————–)
I’ve done some investigating…

If I add this in – this.addChild(photoLoader) into the code than it loads a very small version of the picture onto the screen when i click. I can also access the height and width of the photoLoader item. So I’m guessing that what’s screwing it up is that in this section:

if(photoLoader.source.width > photoLoader.source.height)
{
        trace("landscape");
}
else if(photoLoader.source.width < photoLoader.source.height)
{
trace("portrait");
}
else
{
        trace("fail");
}

and

loaderHolder.graphics.drawRect(0, 0, photoLoader.source.width + 20,              photoLoader.source.height + 20);

The program is trying to get the height and width of the string not the picture. Is there a different sytax I should be using or a step I should be taking in order to load picture in correctly before executing the rest of the function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:59:55+00:00Added an answer on May 26, 2026 at 1:59 am

    photoLoader.source is of type string. That’s is what the runtime is complaining, when it tries to fetch width on the source property. What you need to use is photoLoader.width and photoLoader.height.

    BTW, I think the code won’t get correct width and height until the resource (the picture) actually gets loaded. So, you’d probably need to wait for Event.COMPLETE before checking on height and width of photoLoader.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had the following idea: Say we have a webapp written using django which
I originally had this code written as a series of if statements, but after
UPDATE!! I am sorry for this post, the code I had written for this
As I had written in title, I have SQL query, run on Oracle DB,
I was glancing through some code I had written in my Perl class and
In Ruby I have often written a number of small classes, and had a
I have recently inherited a J2EE Struts web app that was written back in
I have a few stations out at a site at the moment and they
I've written a QuickSort algorithm based off pseudo-code that I had been given. I've
I was overlooking some code that I had written to generate an A-Z navigation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.