-
I am currently working on a project and have to load JPGs in dynamically. I have created a movie clip to import to and the JPG imports. The only thing is that the points (0,0) are at the exact center of the location that I want it to import to. Can anyone help???
-
If you want to control the exact place of where a pic must go
Use an empty MC
The simplest way of getting things done is
Create an empty MC place it on stage and call the instance
say: picHolder
then
The empty MC can be placed excatly on the place you want it
to be. The point off the MC will be the upper left corner
off the Picture.
to load the picture into to the MC use the following code.
Asuming that you load the picture from the same timeline as
were the picHolder is placed
Code:
picHolder.loadMovie(myPic.jpg);
-
ok...im a new user....what is an MC and how do i create it? Thanks for your help
-
ignore the previous response......I did everything you said but I still get the top left hand corner of the imported JPG file in the center of my movie clip.
-
Senior Member
MC stands for movieclip and you create an empty MC by insert new symbol, give it the name picHolder and click on movieclip. Then you press F11 (for mac) and drag the MC on the stage. Click on the MC and write "picHolder" in the property inspector where it says movieclip and an empty field underneath.
-
MC=Movie Clip
Create a new MC call it what ever you want.
Then place an instance of that MC on stage.
Give that instance a name in the property box.
Say, you give the instance the name picHolder
then go to a first frame of any layer
and then place in that frame the
following code
Code:
picHolder.loadMovie(myPic.jpg);
That should load myPic.jpg right into the empty MC picHolder.
Then something else.
Most of the time you want something to be done right after
the picture is loaded.
Flash just keeps on playing the timeline even though the
picture is not fully loaded. This can give problems
when you think the picture is allready loaded.
The sollution for this is to use a method that keeps track
of the loading action of the jpg.
Because you loaded a jpg into a MC you can ask that MC if
it has received all it's data. You can do that with the
following code
Code:
onClipEvent(data) {
// here you can place any code you like that you would
// like to perform right after the picture is finished loading
}
the code above must be placed on the empty MC you called
picHolder.
(Not in the MC picHolder)
You can place this code by clicking the small circle that
represents the MC picHolder on stage
cheers
-
That's how load movie works, the loaded in movie's upper left corner will be at the movie clip's "registration" point.
You have three options. 1) Move your current movie clip so the center point is where you want the top left corner of your loaded image to be. 2) Make the "registration" point of your movie clip in the upper left corner. 3) Load it in and use ActionScript to move the image left and up.
Unless there's a reason why you can't do it, I would suggest using #1 or #2.
-
i got it to load but i cant get it the size I want. Its 600x400 and I want to be able to make it like 200x140. Thank you all for your help!
-
A real cool thing that you can do to control your MC
is this.
From the onClipEvent(data) routine call a function
like this
Code:
onClipEvent(data) {
placePic();
}
then write a small function
Code:
function placePic() {
this._x=100;
this._y=100;
}
The cool thing is that when you call the function placeJPG,
you can reach the properties of picHolder by just simply
call them this._x and this._y
Ofcourse you can do this much simpler, but this is much more
fun!
-
sizing it up can be done with scaling or widht and height
just use the same function and place there also somthing
like
Code:
function placePic() {
this._x=100;
this._y=100;
this._width=200
this._height=140
//or use this._xscale and this._yscale
}
-
ok..im coming along slowly...sorry guys. Im still having difficulting resizing.....the name of the file that im importing is called building2.jpg. So does the code look like this?
function placePic() {
this._width=200;
this._height=140;
}
-
Look allright
But if you have difficulties resizing.
Maybe you should forget about the function.
And just call picHolder directly.
To stick with the function for a second.
Put right after the this._height=140;
The following
Code:
this._width=200;
this.height=140;
trace("resizing")
just to make sure that the function is being called.
But to forget about this function, you could always resize
the picture by calling picHolder directly.
This would look like this.
Code:
picHolder._width=200;
picHolder.height=140;
-
ive tried callin picholder directly and it either doesnt show it or it doesnt resize it....when i put the code in frame one it doesnt resize it and when i put it in the frame i want it to execute it on it just doesnt show it...my AIM is my name so if you have anymore ideas...give me an IM or post..thank you
-
If you'd like I would take a look at your fla file.
just send it to
[email protected]
I will take a look tomorrow,
But first I'm going to sleep now.
-
megsy wants help
hi biker
I got an query to ask you
Situation:I have a main movie.swf and I would like to load 3 or more than that JPEG images, which we need to be incorporated into my movie.swf file. Now what we need is that when you view the web page for the first time then My movie.swf should be played with the first JPEG image, the next time you refresh the web page then My movie.swf should be played with the second JPEG image.
If again refreshed or the user closes the browser and opens a new browser window to view the web page he/she should be able to view My movie.swf with the third JPEG image.
This functionality should be in any random order.
Note: only the JPEG image has to change within the swf on refresh of the web page but the other dynamic functionality of the swf remains the same.
Your help is much appreciated. Thanks in advance.
Regards,
Megsy
-
To determine if a visitor has been on your site allready.
You need something like cookies.
Or at least permission of your internet provider to write files.
so you can keep track if this person has been to your site before.
This will take some knowledge of perl or php.
I don't know much about this subject.
If you would like to go that way, I suggest you
ask this question on the forum Backend&scripting
Another way you can almost adres you question is to
use a random load of jpg's. That you can do with Flash.
For this I suggest you take a look again at
http://board.flashkit.com/board/show...hreadid=344164
Did you try this?
-
could also be done with asp usin gjavascript or vb script to access the cookie info
-
Poof! Whaddya need?
no ASP, PHP, etc. needed!
MX has a new object called SharedObject, which is stored on the user's drive. Please see:
http://www.macromedia.com/support/fl...shared_object/
One important note: if you decide to use the option that supposedly places the shared object (sort of a cookie) in the "root" directory, you will find that it does not end up on the hard drive root, but rather in a folder called localHost. That folder will be within the user's profile.
On an NT machine the path looks like this:
C:\WINNT\Profiles\user\Application Data\Macromedia\Flash Player\localhost
Where user is the user's name.
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
|