I have the following code in a piece of flash I wrote a while ago. It works perfectly well in Flash 5 and 6, but not 7. Can anyone advise me what I need to change to get it working in Flash 9. Iv'e looked for things like loadmovie and cannot see anything that is affected by the changes from Flash 6 to 7. It basically makes a series of movieclips grow when you move over it.
// Main code in root
// Defines Constants
descriptions = new Array();
links = new Array();
descriptions[0] = "Back to home page"
links[0] = "default.htm";
descriptions[1] = "Services we can provide"
links[1] = "services.htm";
descriptions[2] = "Portfolio of work for clients"
links[2] = "portfolio.htm";
descriptions[3] = "The technical skills we possess"
links[3] = "skills.htm";
// Define window functions.
// These will be added to the local window
// object to create the window.methods.
//
// set semaphores
winActive = new Object();
winActive = {state:false, owner:"no-one", fullWindow:false};
bootstrap = true;
//
function scaleMe (me, meActive) {
trace('scale me');
// if I am an active window, I need to grow...
if (meActive) {
var cs = _root[me]._xscale;
var cx = _root[me]._x;
var cy = _root[me]._y;
var scale = 24;
var damp = .72; //.72 will give bounce
xaccel += (_root[me]._x - _root[me]._x)*.2;
yaccel += (_root[me]._y - _root[me]._y)*.2;
saccel += (scale - _root[me]._xscale)*.2;
if (_root[me]._xscale +saccel <=2){
_root[me]._xscale = _root[me]._yscale = 2;
}else{
_root[me]._yscale += saccel;
_root[me]._xscale += saccel;
}
_root[me]._x += xaccel;
_root[me]._y += yaccel;
xaccel *= damp //damp
yaccel *= damp //damp
saccel *= damp //damp
_root.winActive.fullWindow = true
} else {
// ... otherwise I am not the active window and need to shrink.
if (_root[me]._xScale>16) {
_root[me]._xScale = _root[me]._xScale*0.90;
_root[me]._yScale = _root[me]._yscale*0.90;
// if I was previously the active window, I need to relinquish
// this title to let other windows in.
} else {
_root[me]._xScale =16;
_root[me]._yScale = 16;
}
// Because I am not Active I need to shrink
}
}
// Shows description in top associated with image
function showDescription(i) {
trace('show description');
_root.mcDescription.setText(_root.descriptions);
_root.mcDescription.gotoAndPlay("start");
}
// Gos to the website associated with image
function goToLink() {
getURL(links[_root.winActive.owner.charAt(4)]);
}
function setOwner(me) {
trace('setOwner');
var presentOwner = _root.winActive.owner;
// Note charAt below takes last character of name - will need to alter if
// have more than 10 items as only works with single digit
if (_root.winActive.owner <> me) showDescription(me.charAt(4));
_root.winActive.state = true;
_root.winActive.owner = me;
_root.bootstrap = false;
}
function cursorHit (me) {
trace('cursorHit');
// If there is a window currently hit and it is
// not me, I cannot be hit.
if (_root.winActive.state && ((_root.winActive.owner<>me) || _root.bootstrap)) {
return false;
} else {
hit = false;
// if I am currently under the cursor...
if ((_root[me]._x-_root[me]._width/2)<_root._xMouse) {
if ((_root[me]._x+_root[me]._width/2)>_root._xMouse) {
if ((_root[me]._y-_root[me]._height/2)<_root._yMouse) {
if ((_root[me]._y+_root[me]._height/2)>_root._yMouse) {
// ...set me to hit, and lock other windows out.
hit = true;
// this is where if cursor over
_root.setOwner(me);
}
}
}
}
// ... otherwise I was the last hit window, but I
// am not anymore, so I should release control...
if (!hit) {
_root.winActive.state = false;
_root.winActive.owner = "non";
}
}
return hit;
}
stop();
//Code in movie clip
onClipEvent (load) {
// Define my window object and methods.
window = new Object();
window.scale = _root.scaleMe;
window.cursorHit = _root.cursorHit;
// Initialize my home (new pseudo-property).
_parent.homeX = _parent._x;
_parent.homeY = _parent._y;
}
onClipEvent (enterFrame) {
window.scale(_parent._name, window.cursorHit(_parent._name));
}
onClipEvent(mouseUp) {
_root.gotoLink();
}
Any help would be appreciated
Thanks
Andy
// Main code in root
// Defines Constants
descriptions = new Array();
links = new Array();
descriptions[0] = "Back to home page"
links[0] = "default.htm";
descriptions[1] = "Services we can provide"
links[1] = "services.htm";
descriptions[2] = "Portfolio of work for clients"
links[2] = "portfolio.htm";
descriptions[3] = "The technical skills we possess"
links[3] = "skills.htm";
// Define window functions.
// These will be added to the local window
// object to create the window.methods.
//
// set semaphores
winActive = new Object();
winActive = {state:false, owner:"no-one", fullWindow:false};
bootstrap = true;
//
function scaleMe (me, meActive) {
trace('scale me');
// if I am an active window, I need to grow...
if (meActive) {
var cs = _root[me]._xscale;
var cx = _root[me]._x;
var cy = _root[me]._y;
var scale = 24;
var damp = .72; //.72 will give bounce
xaccel += (_root[me]._x - _root[me]._x)*.2;
yaccel += (_root[me]._y - _root[me]._y)*.2;
saccel += (scale - _root[me]._xscale)*.2;
if (_root[me]._xscale +saccel <=2){
_root[me]._xscale = _root[me]._yscale = 2;
}else{
_root[me]._yscale += saccel;
_root[me]._xscale += saccel;
}
_root[me]._x += xaccel;
_root[me]._y += yaccel;
xaccel *= damp //damp
yaccel *= damp //damp
saccel *= damp //damp
_root.winActive.fullWindow = true
} else {
// ... otherwise I am not the active window and need to shrink.
if (_root[me]._xScale>16) {
_root[me]._xScale = _root[me]._xScale*0.90;
_root[me]._yScale = _root[me]._yscale*0.90;
// if I was previously the active window, I need to relinquish
// this title to let other windows in.
} else {
_root[me]._xScale =16;
_root[me]._yScale = 16;
}
// Because I am not Active I need to shrink
}
}
// Shows description in top associated with image
function showDescription(i) {
trace('show description');
_root.mcDescription.setText(_root.descriptions);
_root.mcDescription.gotoAndPlay("start");
}
// Gos to the website associated with image
function goToLink() {
getURL(links[_root.winActive.owner.charAt(4)]);
}
function setOwner(me) {
trace('setOwner');
var presentOwner = _root.winActive.owner;
// Note charAt below takes last character of name - will need to alter if
// have more than 10 items as only works with single digit
if (_root.winActive.owner <> me) showDescription(me.charAt(4));
_root.winActive.state = true;
_root.winActive.owner = me;
_root.bootstrap = false;
}
function cursorHit (me) {
trace('cursorHit');
// If there is a window currently hit and it is
// not me, I cannot be hit.
if (_root.winActive.state && ((_root.winActive.owner<>me) || _root.bootstrap)) {
return false;
} else {
hit = false;
// if I am currently under the cursor...
if ((_root[me]._x-_root[me]._width/2)<_root._xMouse) {
if ((_root[me]._x+_root[me]._width/2)>_root._xMouse) {
if ((_root[me]._y-_root[me]._height/2)<_root._yMouse) {
if ((_root[me]._y+_root[me]._height/2)>_root._yMouse) {
// ...set me to hit, and lock other windows out.
hit = true;
// this is where if cursor over
_root.setOwner(me);
}
}
}
}
// ... otherwise I was the last hit window, but I
// am not anymore, so I should release control...
if (!hit) {
_root.winActive.state = false;
_root.winActive.owner = "non";
}
}
return hit;
}
stop();
//Code in movie clip
onClipEvent (load) {
// Define my window object and methods.
window = new Object();
window.scale = _root.scaleMe;
window.cursorHit = _root.cursorHit;
// Initialize my home (new pseudo-property).
_parent.homeX = _parent._x;
_parent.homeY = _parent._y;
}
onClipEvent (enterFrame) {
window.scale(_parent._name, window.cursorHit(_parent._name));
}
onClipEvent(mouseUp) {
_root.gotoLink();
}
Any help would be appreciated
Thanks
Andy