Image / MC height / _x and _y positioning

FLASH

    Next

  • 1. character input
    Hi, I have a text string. lets say 'Sample'. How can I pull out each character of the string (S-a-m-p-l-e). Can anybody please tell the script for it. Thanks
  • 2. Finding out the dimensions of Jpeg loaded via MovieClipLoader().loadClip
    Well, I crammed it all in the subject. I'm importing Jpegs from the server and I'd like to know the dimensions of the images in order to adapt the environment to the image. Can it be done at all from Flash and without resorting to PHP or other? Sastien
  • 3. x and y coordinates for movie clip
    I am developing a site and I have a button which when pressed goes to another frame and attaches a movie to play, but it attaches it in the upper left corner. I have tried adding an x and y coordinate in the attachMovieClip and createMovieClip, but when doing that it shifts everything in the file to that point. The entire canvas moves down. Any ideas? on (press) { gotoAndPlay("next"); this.createEmptyMovieClip("original_mc", depth++); mcA = ["IceAd_swipe_mc", "Marriott1_mc"]; index = 0; this.attachMovie(mcA[index], "mc", 0 (_x=448, _y=105)); this.onEnterFrame = function() { if (mc._currentframe == mc._totalframes) { index++; if (index<mcA.length) { removeMovieClip(mc); this.attachMovie(mcA[index], "mc", 0); } else { removeMovieClip(mc); } } }; }
  • 4. problem with loading a slide show SWF file
    I run into a problem while loading an external movie, which is an SWF (test.swf) containing 5 keyframes, labeled sequentially, as 1, 2, 3, 4, 5, like a slide show. My code is as the following: //******************* this.createEmptyMovieClip("show_swf", 0); // loadMovie("test.swf", show_swf); //load file trace(show_swf._totalframes); // the number is 1. //*********************** The file is loaded, but only frame 1 is shown. I can not move to other keyframes by using show_swf.nextFrame(), or show_swf.gotoAndStop(Number). Actually, when I traced the value of show_swf._totalframes, it gave me a number 1, instead of 5 that is actually in test.swf. What did I do wrong? David.

Re: Image / MC height / _x and _y positioning

Postby tusharwadekar » Tue, 26 Jun 2007 20:45:00 GMT

 To access height, width of image; you will have to wait till the image loads 
completely. You can use custom loader for this purpose. Or look for 
"MovieClipLoader" class. It provides all necessary events. 


Re: Image / MC height / _x and _y positioning

Postby ++ Barry ++ » Tue, 26 Jun 2007 21:23:47 GMT

thanks.  I have been trying out the code with no luck. I understand whats going 
on in the help files but i cant seem to get it workingwith myown code. Any 
chance of a quick example with my code?

 barry.


Re: Image / MC height / _x and _y positioning

Postby tusharwadekar » Tue, 26 Jun 2007 21:44:02 GMT

Here is the code. You will have to generate imgList array based on your XML 
data. Once done call the function "startLoadingImgs()". It will load all images 
one by one.



 var mcLoader:MovieClipLoader;
 var loadListener:Object = new Object();
 var isLoading:Boolean = false;
 var imgList:Array = ["img_1.jpg", "img_2.jpg", "img_3.jpg"];
 var ind:Number = -1;

 loadListener.onLoadInit = function(target_mc:MovieClip):Void  {
 	isLoading = false;	
 	trace("Loading Image: "+imgList[ind]+" complete.");
 	startLoadingImgs();
 };
 loadListener.onLoadError = function(target_mc:MovieClip, errorCode:String, 
httpStatus:Number) {
 	isLoading = false;
 	trace("Loading Image: "+imgList[ind]+" failed.");
   	startLoadingImgs();
 }

 function loadImage(ind:Number) {
 	if (isLoading) {
 		return;
 	}
 	var img:String = imgList[ind];
 	trace("Loading Image: "+img);
 	isLoading = true;
 	mcLoader = new MovieClipLoader();
 	mcLoader.addListener(loadListener);
 	mcLoader.loadClip(img, image_mc);
 }
 function startLoadingImgs():Void {	
 	ind++
 	if(ind < imgList.length){
 		loadImage(ind);		
 	} else {
 		trace("All Images loaded");

 	}
 }


Similar Threads:

1._x & _y of mc relative to stage and not parent mc

Good Morning all,

 I?m trying to get the _x and _y of a movieclip relative to the stage where 
said movieclip is nested inside several others, which have been dynamically 
rotated. 

 I?m hoping there is an easy way to get this rather then taking the route of 
reverse engineering the position and rotation of each parent movieclip in order 
to calculate it.

 Thanks in advance

 Will 


2.attachMovie and _x, _y position in Flash Player5

I am having an issue with position of a movie on rollover.  It positions fine in Flash Player 6, but is not working with Flash Player 5 (which is what my client wants compatability with).  Here is the code I am using:

on (rollOver) 
{
	gotoAndPlay("WorkLife");
	//_root.attachMovie("textBox_mc", "textBox",3,{_x:97.9, _y:91});
	_root.attachMovie("workLifeDesc_mc", "workLifeDesc",4, {_x:25.9, _y:68});
}
on (rollOut)
{
	gotoAndPlay("Empty");
	_root.attachMovie("instructions_mc", "instuctions",4 ,{_x:25.9, _y: 19.9})
}

In Flash Payer 5, the movie is loading at 0,0 . .. ignoring the x and y positioning i entered.  Its fine when I test with Flash Player 6.  



3.Setting and remembering _x _y of MC

So, Im able to store the x, y position of a dragable mc in a var but how do I 
set the position of XMc when a user goes back to that screen? I need XMc to 
remember where it last was(I have that) and go there when you enter frame(I 
dont have that).




 XMc.onPress = function() {
 	XMc.startDrag("");
 	XMc.gotoAndStop(2);
 };
 XMc.onRelease = function() {
 	XMc.stopDrag();
 	XMc.gotoAndStop(1);
 	myX = _xmouse;
 	myY = _ymouse;
 	XmyXY = String(myX)+","+String(myY);
 	trace (XmyXY);
 };

4._x and _y wrong

hi all

 i have this in a movieclip called map 
 on (release) {
 	_root.map._x = 138.1;
 	_root.map._y = 80.4;
 }
  but when i press it it goes to about          ._x = 75.8    ._y = 26.1
 how can i stop it

5._x and _y coordinate question

Hello:

 I have a movieclip that is navigated by buttons to various _x and _y 
coordinates. When the user clicks on "button 1" is takes them to a specified 
area, then when the user clicks "button2" is takes them to another area. 
However, the pathway is a straight line between the two. 

 I would like the "path" to negotiate a determined route, (such as a curved or 
"S" shaped route). Is it possible to put a series of _x and _y coordinates into 
the onClipEvent then the final _x and _y coordinate for a final destination, 
(Similar to waypoints in a GPS).

 If so, is there a simple way that "people that know what they are doing" 
calculate  _x and _y coordinates within a movieclip?

 Regards,

 Stephen

6. flash _X and _y properties

7. buttons/movieclip on a path - how to get _x and _y

8. quirky _x, _y values



Return to FLASH

 

Who is online

Users browsing this forum: No registered users and 48 guest