FORUMS: list search recent posts

** Position Objects in movieClip on stage***

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Aisha Nelson
** Position Objects in movieClip on stage***
on Jun 23, 2010 at 1:58:03 am

Please help!!! I am having an issue with positioning the main image in my gallery. Take a look at the link to the site on the "resource" page you will find the problem the link is:

http://numediadesigns.net/Watson/RDW_WebsiteII.html

Please help!
Here is the code that I am using.
import fl.transitions.Tween;
import fl.transitions.easing.*;


var bgHOffset = 2*imgMc.x; //set double image clip width and over
var bgVOffset = 2*imgMc.y; //set double border width and over

var mcPath = this;

var twIn;
var twOut;


mcPath.visible = false;

var loaderanim = this.parent.loaderanim;

var yoffset = -50; //offset to adjust the position of big image on y axis
var xoffset = 0; //offset to adjust the position of big image on x axis

function progress_loading(e:Event) {
//var bLoaded = e.target.bytesLoaded;
//var bTotal = e.target.bytesTotal;
//loaderanim.rotation += 5;
loaderanim.circle.rotation += 5;
}

// This is done after the img/swf is loaded
function finished_loading(e:Event) {
loaderanim.visible = false; //hide the animation movie
//loaderanim.x = (mcPath.width - loaderanim.width)/2;
//loaderanim.y = (mcPath.height - loaderanim.height)/2;
setBoxElements(); //set box elements
}



function setBoxElements() {

//RESIZE BORDER TO FIT THE NEW LOADED IMAGE SIZE//
border.width = imgMc.width + bgHOffset;
border.height = imgMc.height + bgVOffset;

//RESIZE DESCRIPTION TEXT AND BACKGROUND TO FIT THE NEW LOADED IMAGE SIZE//
imageDescriptionBox.imageDescription.tf.autoSize = "left";
imageDescriptionBox.imageDescription.tf.width = imgMc.width;

imageDescriptionBox.imageDescription.bg.width = imgMc.width;
imageDescriptionBox.imageDescription.bg.height = imageDescriptionBox.imageDescription.tf.height;

imageDescriptionBox.y = imgMc.height - imageDescriptionBox.height;


//SET THE IMAGE BOX POSITION ON THE STAGE//
if (mcPath.width > stage.stageWidth) mcPath.x = 0;
else
mcPath.x = (stage.stageWidth - mcPath.width)/2;


if (mcPath.height > stage.stageHeight) mcPath.y = 0;
else
mcPath.y = (stage.stageHeight - mcPath.height)/2;


mcPath.y += yoffset*2;
mcPath.x += xoffset;


//FADE IN IMAGE BOX//
fadeIn();

//FADE OUT WHEN USER PRESS THE IMAGE BOX//
mcPath.buttonMode = true;
mcPath.useHandCursor = true;
mcPath.mouseChildren = false;
mcPath.addEventListener("mouseDown",addPressHandler);

}


// FADE EACH IMAGE ON THE STAGE AFTER THE MOVIE IS LOADED//

function fadeIn() {

mcPath.visible = true;

var func1 = Regular.easeOut;
var xs = 0;
var xf = 1;
var duration1 = 0.75;

twIn = new Tween(mcPath, "alpha", func1, xs, xf, duration1, true);
}

function fadeOut() {

var func1 = Regular.easeOut;
var xs = 1;
var xf = 0;
var duration1 = 0.75;

twOut = new Tween(mcPath, "alpha", func1, xs, xf, duration1, true);
twOut.addEventListener("motionFinish",finishHandler);
}

function finishHandler(e:Event) {
mcPath.visible = false;
}

function addPressHandler(e:Event){
//fadeOut();
mcPath.removeEventListener("mouseDown",addPressHandler);

stage.addEventListener(MouseEvent.MOUSE_UP, releaseHandler);
}


function releaseHandler(e:MouseEvent) {

//ADD CUSTOM CODE HERE WHEN THE IMAGE IS RELEASED

//brelease();
var obj = mcPath.parent.hmenu.menu.activeMc;

var setLink = ((obj["info"].attributes.link!=undefined) && (obj["info"].attributes.link!=""));

//open external HTML page if any
if (setLink) {
var request1:URLRequest = new URLRequest(obj["info"].attributes.link);
navigateToURL(request1,obj["info"].attributes.window);
}


// be sure to clean up stage listener
stage.removeEventListener(MouseEvent.MOUSE_UP, releaseHandler);
//releaseOutsideTarget = null;

}


Return to posts index

demetri tashie
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 2:00:28 pm

i am trying to understand this, but am having a little difficulty. seeing the file would surely help - if you want to post it or send it, i'd be glad to take a look.

without seeing more it is hard to say. my initial thoughts though is that it is just a simple registration problem - you are calculating the x position based on the center of a container ( is that mcPath ? ) whereas its x reg point might be something else.

at the very least you can play around with decreasing the x pos until it sits where you want it ( it seems about 1/4 off to me )

i would look here to begin with:
var bgHOffset = 2*imgMc.x; //set double image clip width and over and
if (mcPath.width > stage.stageWidth) mcPath.x = 0;
else
mcPath.x = (stage.stageWidth - mcPath.width)/2;


those 2 might be combining and accounting for the 1/4

also, what is this line supposed to do since xoffset was earlier declared as zero? :
mcPath.x += xoffset;





Return to posts index

Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 2:45:19 pm

I uploaded the file I'm using.


Return to posts index


demetri tashie
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 2:49:08 pm




where ??


Return to posts index

Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:07:29 pm

859_2dzoomgallery.fla.zip


Return to posts index

demetri tashie
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:18:20 pm


send your XML file also, so i don't have to re-create it...


Return to posts index


Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:22:31 pm

860_config.xml.zip


Return to posts index

demetri tashie
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:26:08 pm


was this a component purchased from flashcomponents.net ?


Return to posts index

Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:47:35 pm

yes.


Return to posts index


demetri tashie
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 3:56:59 pm

try this and tell me what happens:

//SET THE IMAGE BOX POSITION ON THE STAGE//
if (mcPath.width > stage.stageWidth) mcPath.x = 0;
else
mcPath.x = (stage.stageWidth - mcPath.width)/2.25;


if (mcPath.height > stage.stageHeight) mcPath.y = 0;
else
mcPath.y = (stage.stageHeight - mcPath.height)/7;




Return to posts index

Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 24, 2010 at 4:01:57 pm

ok. I will try


Return to posts index

Aisha Nelson
Re: ** Position Objects in movieClip on stage***
on Jun 29, 2010 at 7:57:56 pm

Sorry forgot to respond, but it did work. Thanks demetri


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]