Skip to main content
Participant
April 16, 2006
Answered

Loading images into movieclip

  • April 16, 2006
  • 2 replies
  • 299 views
Hi guys,

I'm new here! I wondered if anyone could explain to me what I'm doing wrong here.

As part of a Flash-based campus mapping system, I am trying to create a 'Room Information' box that will display certain information regarding rooms around the campus, based upon data stored in a Microsoft Access database.

The .asp file I am using is working correctly, and my dynamic text boxes are correctly displaying the information as each database record is queried.

However, I am also trying to display an image of the room. The image files are located in the same directory as the .swf, they are non-progressive .jpgs. I have been trying to use the following code (which works for everything but the images):

onClipEvent(data)
{
// Create a Movie Clip to load images into
mcRoomDatabase.createEmptyMovieClip("MyImagesHolder", 0);

strName = Name;
strBuilding = Building;
strType = Type;
strProjector = Projector;
strSeats = Seats;
strRoamNet = RoamNet;
strPosition = "Record " add String(CurrentRecord+1) add " of " add String(TotalRecords);

loadMovie(Name + ".jpg", mcRoomDatabase.MyImagesHolder);

}

-----------

Nothing is loading into the movieclip. If I use the code (for an imaginary room called Room100)

loadMovie("Room100.jpg", mcRoomDatabase.MyImagesHolder);

the image displays perfectly. If I set a new dynamic text box to display

Name + ".jpg"

it displays Room100.jpg, which is the same as what I'm entering when I try it directly above.


I'm confused as to where I'm going wrong? Sorry for the long post!

Many thanks for reading

Alex
This topic has been closed for replies.
Correct answer Newsgroup_User
It is not clear if you are loading an external movie and then in the
external movie loading a jpg. If you are you have timing problem in that the
script is not syncronous and may execute before the swf is completely
loaded.

You are better off with MovieClipLoader if you need to know when the swf is
loaded so then you can perform methods on the loaded swf.

Or you can insert the code for loading the image in each external swf.

Other points:
1.
onClipEvent(data)
{
I believe fires everytime bytes arrive which could be many times depending
on if you are in test mode or live.
2.
add operator is deprecated. Use + instead.

http://livedocs.macromedia.com/flash/8/main/00002924.html

3. If you are creating a mission critical app your code reveals you need to
update your AS skills as you are using older techniques.


--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"UK Alex" <webforumsuser@macromedia.com> wrote in message
news:e1uj2d$rm4$1@forums.macromedia.com...
Hi guys,

I'm new here! I wondered if anyone could explain to me what I'm doing wrong
here.

As part of a Flash-based campus mapping system, I am trying to create a
'Room
Information' box that will display certain information regarding rooms
around
the campus, based upon data stored in a Microsoft Access database.

The .asp file I am using is working correctly, and my dynamic text boxes
are
correctly displaying the information as each database record is queried.

However, I am also trying to display an image of the room. The image files
are
located in the same directory as the .swf, they are non-progressive .jpgs. I
have been trying to use the following code (which works for everything but
the
images):

onClipEvent(data)
{
// Create a Movie Clip to load images into
mcRoomDatabase.createEmptyMovieClip("MyImagesHolder", 0);

strName = Name;
strBuilding = Building;
strType = Type;
strProjector = Projector;
strSeats = Seats;
strRoamNet = RoamNet;
strPosition = "Record " add String(CurrentRecord+1) add " of " add
String(TotalRecords);

loadMovie(Name + ".jpg", mcRoomDatabase.MyImagesHolder);

}

-----------

Nothing is loading into the movieclip. If I use the code (for an imaginary
room called Room100)

loadMovie("Room100.jpg", mcRoomDatabase.MyImagesHolder);

the image displays perfectly. If I set a new dynamic text box to display

Name + ".jpg"

it displays Room100.jpg, which is the same as what I'm entering when I try
it
directly above.


I'm confused as to where I'm going wrong? Sorry for the long post!

Many thanks for reading

Alex


2 replies

Newsgroup_UserCorrect answer
Inspiring
April 17, 2006
It is not clear if you are loading an external movie and then in the
external movie loading a jpg. If you are you have timing problem in that the
script is not syncronous and may execute before the swf is completely
loaded.

You are better off with MovieClipLoader if you need to know when the swf is
loaded so then you can perform methods on the loaded swf.

Or you can insert the code for loading the image in each external swf.

Other points:
1.
onClipEvent(data)
{
I believe fires everytime bytes arrive which could be many times depending
on if you are in test mode or live.
2.
add operator is deprecated. Use + instead.

http://livedocs.macromedia.com/flash/8/main/00002924.html

3. If you are creating a mission critical app your code reveals you need to
update your AS skills as you are using older techniques.


--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"UK Alex" <webforumsuser@macromedia.com> wrote in message
news:e1uj2d$rm4$1@forums.macromedia.com...
Hi guys,

I'm new here! I wondered if anyone could explain to me what I'm doing wrong
here.

As part of a Flash-based campus mapping system, I am trying to create a
'Room
Information' box that will display certain information regarding rooms
around
the campus, based upon data stored in a Microsoft Access database.

The .asp file I am using is working correctly, and my dynamic text boxes
are
correctly displaying the information as each database record is queried.

However, I am also trying to display an image of the room. The image files
are
located in the same directory as the .swf, they are non-progressive .jpgs. I
have been trying to use the following code (which works for everything but
the
images):

onClipEvent(data)
{
// Create a Movie Clip to load images into
mcRoomDatabase.createEmptyMovieClip("MyImagesHolder", 0);

strName = Name;
strBuilding = Building;
strType = Type;
strProjector = Projector;
strSeats = Seats;
strRoamNet = RoamNet;
strPosition = "Record " add String(CurrentRecord+1) add " of " add
String(TotalRecords);

loadMovie(Name + ".jpg", mcRoomDatabase.MyImagesHolder);

}

-----------

Nothing is loading into the movieclip. If I use the code (for an imaginary
room called Room100)

loadMovie("Room100.jpg", mcRoomDatabase.MyImagesHolder);

the image displays perfectly. If I set a new dynamic text box to display

Name + ".jpg"

it displays Room100.jpg, which is the same as what I'm entering when I try
it
directly above.


I'm confused as to where I'm going wrong? Sorry for the long post!

Many thanks for reading

Alex


UK_AlexAuthor
Participant
April 17, 2006
Dear Newsgroup User,

Many thanks for your reply.

I took your advice and did some reading in this particular area and made some changes to bring my code up to a more modern standard - everything works perfectly now.

Thanks again for your help.

Best wishes,

Alex