I’m currently building an as2/tweenlite image viewer for my portfolio site. The image viewer resizes dynamically to the shape of the image loaded. My problem is that i can’t get swf’s to work. When a 300x250 swf is loaded in to the image viewer, the viewer sizes to about 700x620 with the swf up in the right hand corner. All of the elements in the swf are messed up and mis placed as well. Please help i can’t figure this out
Everything works perfectly except the swf handling.
here is the code
import gs.TweenLite;
import gs.TweenFilterLite;
import gs.easing.*
descriptions = true;
alert._visible = false;
_root.workImage.but._visible = false;
_root.workImage.dis._visible = false;
_root.workImage.barra._visible = false;
var workLoadListener:Object = new Object();
workLoadListener.onLoadInit = function(my_mc:MovieClip):Void {
my_mc._alpha = 0;
my_mc._x = 0-(my_mc._width/2);
my_mc._y = 0-(my_mc._height/2);
TweenFilterLite.to(_root.workImage.imagebox, 1, { _width:my_mc._width+16, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.imagebox, 1, { _height:my_mc._height+30, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.dis.shape, 1, { _width:my_mc._width+16, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.ControlPanel, 1, { _width:my_mc._width+16, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.itte, 1, { _width:my_mc._width+16, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.itte, 1, { _height:my_mc._height+16, overwrite:false, ease:Expo.easeInOut});
TweenFilterLite.to(my_mc, 2, {blurFilter:{blurX:0, blurY:0}, _alpha:100, ease:Expo.easeInOut});
TweenFilterLite.to(_root.workImage.but, 2, {blurFilter:{blurX:0, blurY:0},delay:0.2, _xscale:72, _yscale: 72, autoAlpha:100, ease:Expo.easeInOut});
};
TweenLite.to(_root.workImage.imag, 1, { autoAlpha:100, ease:Expo.easeInOut});
_root.workImage.image_preload.onEnterFrame = function() {
preloader = _root.workImage.myImage.getBytesLoaded()/_root.workImage.myImage.getBytesTotal()*100;
if (preloader<100) {
this.bar.glowTo(0x000000, 1, 5, 1, 2, undefined, undefined, 2);
this.bar.Tooltiploader.txt = Math.round(preloader)+"%";
this.bar.loader._xscale = preloader;
this.bar.Tooltiploader._x = preloader;
}
};
_root.workImage.hitt.onRelease=function(){
if(_root.workImage.dis._alpha==0){
TweenFilterLite.to(_root.workImage.dis, 2, {blurFilter:{blurX:0, blurY:0}, autoAlpha:100, ease:Expo.easeInOut});
}else{
TweenFilterLite.to(_root.workImage.dis, 2, {blurFilter:{blurX:0, blurY:0}, autoAlpha:0, ease:Expo.easeInOut});
}
}
forward.onRollOver=function(){
TweenLite.to(forward.box6.base, 2, {tint:0xF08222, ease:Elastic.easeOut});
TweenLite.to(forward.box6.tig, 1, {tint:0x000000, ease:Elastic.easeOut});
TweenLite.to(forward.box6, 1, {_xscale:80, _yscale:80, ease:Elastic.easeOut});
}
forward.onRollOut=function(){
TweenLite.to(forward.box6.base, 2, {removeTint:true, ease:Elastic.easeOut});
TweenLite.to(forward.box6.tig, 1, {removeTint:true, ease:Elastic.easeOut});
TweenLite.to(forward.box6, 1, {_xscale:72, _yscale:72, ease:Elastic.easeOut});
}
back.onRollOver=function(){
TweenLite.to(back.box6.base, 2, {tint:0xF08222, ease:Elastic.easeOut});
TweenLite.to(back.box6.tig, 1, {tint:0x000000, ease:Elastic.easeOut});
TweenLite.to(back.box6, 1, {_xscale:80, _yscale:80, ease:Elastic.easeOut});
}
back.onRollOut=function(){
TweenLite.to(back.box6.base, 2, {removeTint:true, ease:Elastic.easeOut});
TweenLite.to(back.box6.tig, 1, {removeTint:true, ease:Elastic.easeOut});
TweenLite.to(back.box6, 1, {_xscale:72, _yscale:72, ease:Elastic.easeOut});
}
var myImageLoader:MovieClipLoader = new MovieClipLoader();
myImageLoader.addListener(workLoadListener);
var ease = 3;
_root.scala_x = 90;
_root.scala_y = 110;
_root.barra_stato = "true";
_root.box.useHandCursor = false;
thumbs = new XML();
thumbs.ignoreWhite = true;
thumbs.load("dati.xml");
thumbs.onLoad = function() {
root = this.firstChild;
total = root.childNodes.length;
displayNum = Number(root.childNodes[0].attributes.displayNum);
separation = Number(root.childNodes[0].attributes.separation);
w = 45;
h = 45;
mask._width = displayNum*(w+separation);
mask._height = h+30;
forward._x = mask._width+20;
forward._y = back._y=h/2;
mcs = [];
for (i=0; i<total; i++) {
mcs.push(i);
newThumb = thumbnailer.container.duplicateMovieClip("container"+i, i);
with (newThumb) {
_x = (w+separation)*i;
preloader._x = w/2;
preloader._y = h/2;
shape._width = w;
shape._height = h;
}
var image = root.childNodes*.childNodes[0].firstChild.nodeValue;
var image1 = root.childNodes[0].childNodes[0].firstChild.nodeValue;
newThumb.image = root.childNodes*.childNodes[0].firstChild.nodeValue;
newThumb.desc = root.childNodes*.childNodes[1].firstChild.nodeValue;
newThumb.texty = root.childNodes*.childNodes[2].firstChild.nodeValue;
myImageLoader.loadClip(image1, _root.workImage.myImage);
_root.workImage.dis.distxt.text = newThumb.desc;
_root.workImage.dis.tittxt.text = newThumb.texty;
newThumb.onRelease();
newThumb.cont.loadMovie(image);
newThumb.cont2.loadMovie(image);
newThumb.cont._xscale = 30;
newThumb.cont._yscale = 30;
newThumb.cont2._xscale = newThumb.cont._xscale;
newThumb.cont2._yscale = newThumb.cont._yscale;
newThumb.onRelease = function() {
myImageLoader.loadClip(this.image, _root.workImage.myImage);
_root.workImage.dis.distxt = this.texty;
_root.workImage.dis.tittxt = this.desc;
};
if (descriptions) {
newThumb.onRollOver = function() {
alert.desc = this.desc;
TweenFilterLite.to(alert, 1, {blurFilter:{blurX:0, blurY:0}, autoAlpha:100, ease:Expo.easeOut});
TweenFilterLite.to(this, 1, {colorMatrixFilter:{colorize:0xF08222, amount:1}, ease:Elastic.easeOut});
this.swapDepths(9);
};
newThumb.onRollOut = function() {
TweenFilterLite.to(alert, 0.6, {blurFilter:{blurX:5, blurY:5}, autoAlpha:0, ease:Expo.easeInOut});
TweenFilterLite.to(this, 1, {colorMatrixFilter:{colorize:0xFF0000, amount:0}, ease:Elastic.easeOut});
};
}
}
var offset = total-1;
var dest = 0;
var increment = w+separation;
var ending = (total-displayNum)*(w+separation);
var lastmc = total-1;
var firstmc = 0;
back.onRelease = function() {
if (dest<0) {
dest += increment;
} else {
first = mcs[0];
for (k=0; k<total; k++) {
mcs[k] = mcs[k+1];
}
mcs[total-1] = first;
thumbnailer["container"+lastmc]._x = -(w+separation);
firstmc = lastmc;
for (k=0; k<total; k++) {
if (mcs[k] == (total-1)) {
lastmc = k;
}
}
}
};
forward.onRelease = function() {
if (dest>-ending) {
dest -= increment;
} else {
last = mcs[total-1];
for (k=1; k<total; k++) {
mcs[total-k] = mcs[total-k-1];
}
mcs[0] = last;
thumbnailer["container"+firstmc]._x = (displayNum)*(w+separation);
lastmc = firstmc;
for (k=0; k<total; k++) {
if (mcs[k] == 0) {
firstmc = k;
}
}
}
};
onEnterFrame = function () {
for (j=0; j<total; j++) {
thumbnailer["container"+j]._x += (dest+(mcs[j])*(w+separation)-thumbnailer["container"+j]._x)/ease;
}
alert._x = _xmouse;
alert._y = _ymouse;
};
};