![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Регистрация: Mar 2009
Сообщений: 29
|
Здравствуйте..
снова непонятные шоквейверу вещи творятся во Флеше ![]() Имеется мувиклип с подгруженной приаттаченной битмапкой (png). при _rotation =0 всё отлично.. Стоит только изменить поворот, как картинка тут же "сплющивается" относительно своей верхней (по верхней границе) горизонтальной оси... при повороте на 90 градусов сплющивается до такой степени, что становится вообще не видна на сцене, хотя при всех этих манипуляциях oInstance._width и oInstance._height выдают правильные значения ![]() Самое забавное - что при увеличении угла (более 90 град.) картинка начинает "расплющиваться" и к 180 градусам приобретает обычные пропорции.. PS: Картинки во вложении. Помогите пожалуйста. Последний раз редактировалось alex_blackout; 26.03.2009 в 14:58. |
|
|||||
|
Регистрация: Mar 2009
Сообщений: 29
|
К сожалению, не выйдет
![]() Архив 895 кБ. Учитывая мой опыт программирования во Флеше, невероятную спешку и много мусора в коде, уверен, что где-то что-то упустил.. В мувике 3 кадра: 1й кадр : splitD = function (str, delimiter) {
trace("splitLOAD");
str = str.split (delimiter[0]);
if (delimiter.length > 1) {
for (var i = 0; i < str.length; i++) {
if (str[i].indexOf (delimiter[1]) != -1) {
str[i] = splitD (str[i], delimiter.slice (1));
}
}
}
return str;
};
_global.animated = false;
_global.containerList = new (Array);
var inputstr:String = "bitmap,http://eaw.dxloo.com/png/10.png,126,38,127,127,0,0,0,100,1,0,100,0x000000,4,0,0,5,0,200,0xFF0000,6,0,0,100,0xFFFFFF,0x000000,4,0,0#text,0,389,71,500,1,0,0,0,100,2,0,100,0x000000,4,0,0,5,0,200,0xFF0000,6,0,0,100,0xFFFFFF,0x000000,4,0,Input Text Here,Arial,72,0,0,0,0x00FFFF,0xFFFFFF,100,0";//_level0.inputarray;
var InputList:Array = splitD(inputstr, ["#", ","]);
//var InputList:Array = [["text","", [95, 72], [1000, 128], 0, [0, 0], 40,1, [[0, 100, 0x0033cc, 4, 0], [0, 5], [0, 200, 0xff33cc, 6, 0], [0, 100, 0xFF0000, 0xff33cc, 4, 0]], "The Text",["Arial", 72, [1,0,0], "0x002F00", "0x00FFFF" ,32, 0]],["bitmap","http://eaw.dxloo.com/html/lib/logos/10.png", [5, 31], [55,128], 0, [0, 0], 60,1, [[0, 100, 0xff33cc, 4, 1], [0, 5], [0, 200, 0xff33cc, 10, 0], [0, 100, 0xFF0000, 0xff33cc, 4, 0]], 0,0],["bitmap","http://eaw.dxloo.com/html/lib/logos/104.png", [142, 31], [65,45], 0, [0, 0], 60,2, [[0, 100, 0xff33cc, 4, 1], [0, 5], [0, 200, 0xff33cc, 10, 0], [0, 100, 0xFF0000, 0xff33cc, 4, 0]], 0,0]];
var counter:Number = 0;
trace("inputstr= " +inputstr);
trace("inputList= " +InputList);
for (i=0;i<InputList.length;i++){
if (InputList[i][0] == "bitmap"){
// var pWidth:Number = InputList[i][3][1];
// var pHeight:Number = InputList[i][3][2];
var mcLdr:MovieClipLoader = new MovieClipLoader();
var cont:MovieClip = this.createEmptyMovieClip("container_mc"+i, this.getNextHighestDepth());
mcLdr.loadClip(InputList[i][1], cont);
trace("Loading clip from: "+InputList[i][1]);
counter = counter +1;
mcLdr.addListener(this);
_global.containerList[i] = cont;
}else{
_global.containerList[i] = 0;
}
}
//function onLoadProgress(mc:MovieClip, l:Number, t:Number):Void
//{
// trace("подождите идёт загрузка....."+Math.round(l/t*100)+"%");
//}
function onLoadInit(cont:MovieClip, counter) {
if (counter < InputList.length) {
//stop();
// this.mcLdr.removeListener(this);
// delete this.mcLdr;
// //cont._width = this.pWidth;
// //cont._height = this.pHeight;
}else{
gotoAndPlay(2);
}
}
|
|
|||||
|
Регистрация: Mar 2009
Сообщений: 29
|
2й кадр:
import flash.display.BitmapData;
//import flash.display.BlurFilter;
//import flash.display.DropShadowFilter;
onEnterFrame = function() {
//read external parameter
InputArray = new (array);
var inputStr:String = "bitmap,http://eaw.dxloo.com/png/10.png,126,38,127,127,89,0,0,60,1,0,100,0x000000,4,0,0,5,0,200,0xFF0000,6,0,0,100,0xFFFFFF,0x000000,4,0,0#text,0,389,71,500,1,0,0,0,100,2,1,100,0x000000,4,0,0,5,0,200,0xFF0000,6,0,0,100,0xFFFFFF,0x000000,4,0,Input Text Here,Verdana,72,0,0,0,0x00FFFF,0xFFFFFF,100,0";//_level0.inputarray;
var InputArray:Array = splitD (inputStr, ["#", ","]);
//InputArray =[["text", "", [55, 22], [1000, 128],0, [0, 0], 40, 1, [[0, 100, "0x000000", 4, 0], [0, 5], [0, 200, "0xFF0000", 6, 0], [0, 100, "0xFFFFFF", "0x000000", 4, 0]], "Alex Dealership", ["Verdana", 50, [1, 0, 0], "0xCC0000", "0xFFFFFF", 40, 0]]];
//InputArray = [["text","", [60, 22], [220, 62], 0, [0, 0], 100,1, [[1, 100, 0xFF0000, 4, 1], [1, 1], [0, 200, 0xff33cc, 6, 0], [1, 100, 0xFF0000, 0xff33cc, 4, 0]], "The Text",["Arial", 72, [1,0,0], "0x002F00", "0x00FFFF" ,32, 0]],["bitmap","http://eaw.dxloo.com/html/lib/logos/10.png", [45, 71], [55,128], 0, [0, 0], 100,1, [[1, 100, 0xff33cc, 4, 1], [1, 5], [0, 200, 0xff33cc, 10, 0], [0, 100, 0xFF0000, 0xff33cc, 4, 0]], 0,0],["bitmap","http://eaw.dxloo.com/html/lib/logos/104.png", [442, 31], [65,45], 0, [0, 0], 90,2, [[0, 100, 0xff33cc, 4, 0], [1, 6], [0, 200, 0xff33cc, 10, 0], [0, 100, 0xFF0000, 0xff33cc, 4, 0]], 0,0]];
//trace(InputArray);
mylabel.text = InputArray[0][0];
trace("objlength " + InputArray[0].length);
//parse external parameter
pCount = InputArray.length;
trace("pCount= " + pCount);
for(i=0; i<pCount;i++) {
trace(i);
trace("begin loop");
//read the object
//object type
pType = InputArray[i][0];
trace("pType " + pType);
pLink = InputArray[i][1];
trace("plink " + pLink);
pLocH = int(InputArray[i][2]);
trace("plocH " +pLocH);
pLocV = int(InputArray[i][3]);
trace("pLocV " +pLocV);
pWidth = int(InputArray[i][4]);
trace("pWidth " + pWidth);
pHeight = int(InputArray[i][5]);
trace("pHeight " +pHeight);
pRotation = int(InputArray[i][6]);
trace("pRotation " +pRotation);
pFlipH = int(InputArray[i][7]);
trace("pFlipH " +pFlipH);
pFlipV = int(InputArray[i][8]);
trace("pFlipV" +pFlipV);
pBlend = int(InputArray[i][9]);
trace("pBlend " +pBlend);
pDeep = int(InputArray[i][10]);
trace("pDeep " +pDeep);
// Creating an Object
if (pType == "text") {
pLayer = this.createEmptyMovieClip("Object"+i,(i+1));
trace("Creating TEXT");
//TextContent
pText = InputArray[i][29];
trace("pText " + pText);
//TextProps
lTextProps = InputArray[i];
pFont = lTextProps[30];
pFontSize = int(lTextProps[31]);
//pFontStyle = lTextProps[32];
pForeColor = lTextProps[35];
pBackColor = lTextProps[36];
pBlend = int(lTextProps[37]);
pInk = int(lTextProps[38]);
trace("text propcs INK " + pInk);
trace("pFontStyle " + pFontStyle);
trace("pLayer " + pLayer);
oInstance = pLayer.createTextField("layer"+pDeep,pDeep, pLocH, pLocV, pWidth, pHeight);
//trace("vText " + oInstance);
oInstance.text = pText;
oInstance.embedFonts = false;
myFormat = new (TextFormat);
myFormat.font = pFont;
trace("font= "+pFont);
myFormat.bold = int(InputArray[i][32]);
myFormat.italic = int(InputArray[i][33]);
myFormat.underline = int(InputArray[i][34]);
myFormat.size = int(pFontSize);
oInstance.setTextFormat(myFormat);
oInstance.textColor =pForeColor;
oInstance.backgroundColor = pBackColor;
trace("pInk="+pInk.valueOf());
oInstance.background = int(pInk);
oInstance.selectable = false;
oInstance.autoSize = true;
trace(oInstance);
trace(oInstance._x);
var newBitmap:BitmapData = new BitmapData(1000, 128, true, 0);
trace("myBitmap: " + newBitmap);
newBitmap.draw(oInstance);
nLayer = this.createEmptyMovieClip("mc"+i, this.getNextHighestDepth());
//tWidth = oInstance._width;
//tHwight = oInstance._height;
oInstance.removeTextField();
oInstance = 0;
//oInstance.removeMovieClip("container"+i);
nLayer.attachBitmap(newBitmap, nlayer.getNextHighestDepth());
oInstance = nLayer;
}else { //BITMAP
oInstance = _global.containerList[i];
trace("containerList="+_global.containerList+" and oInstance="+oInstance);
//trace(oInstance._width)
// newBitmap.draw(oInstance);
//oInstance = nLayer.attachBitmap(newBitmap, nlayer.getNextHighestDepth());
//_level0.removeMovieClip(oInstance);
oInstance._x = pLocH;
oInstance._y = pLocV;
oInstance._rotation = pRotation;
oInstance._width = pWidth;
oInstance._height= pHeight;
trace("W-H = " + pWidth+"-"+pHeight);
//oInstance._alpha = pBlend;
//oInstance._visible = 0;
}
oInstance._x =pLocH;
oInstance._y = pLocV;
trace("and "+oInstance);
oInstance._alpha = pBlend;
oInstance._width = tWidth;
oInstance,_height = tHeight;
oInstance._rotation =pRotation;
var myBlurFilter = new flash.filters.BlurFilter();
myBlurFilter.blurX = 1;
myBlurFilter.blurY = 1;
var myFilters:Array = oInstance.filters;
myFilters.push(myBlurFilter);
oInstance.filters = myFilters;
//Собираем DropShadowFilter
trace("Shadow" + InputArray[i][11]);
if ( InputArray[i][11]=="1") {
var myDropShadowFilter = new flash.filters.DropShadowFilter();
myDropShadowFilter.strength = int(InputArray[i][12]/100);
myDropShadowFilter.color = InputArray[i][13];
myDropShadowFilter.blurX = int(InputArray[i][14]);
myDropShadowFilter.blurY = int(InputArray[i][14]);
myDropShadowFilter.knockout = int(InputArray[i][15]);
myFilters.push(myDropShadowFilter);
//oInstance.filters = myFilters;
}
trace( "Blur" +fBlur[0]);
//Собираем BlurFilter
if ( InputArray[i][16]==1) {
var myBlurFilter = new flash.filters.BlurFilter();
myBlurFilter.enabled = InputArray[i][16];
myBlurFilter.blurY = InputArray[i][17];
myBlurFilter.blurX = InputArray[i][17];
myFilters.push(myBlurFilter);
}
trace("Glow" + fGlow[0]);
//Собираем GLOW FILTER
if (InputArray[i][18]==1){
var myGlow = new flash.filters.GlowFilter();
myGlow.strength = InputArray[i][19]/100;
myGlow.color = InputArray[i][20];
myGlow.blurX = InputArray[i][21];
myGlow.blurY = InputArray[i][21];
myGlow.knockout = InputArray[i][22];
myFilters.push(myGlow);
}
trace("Bevel " + fBevel[0]);
//Собираем Bevel
if (InputArray[i][23]==1) {
var myBevel = new flash.filters.BevelFilter();
myBevel.strength = InputArray[i][24]/100;
myBevel.highlightcolor = InputArray[i][25];
myBevel.shadowcolor = InputArray[i][26];
myBevel.blurX = InputArray[i][27];
myBevel.blurY = InputArray[i][27];
myBevel.knockout = InputArray[i][28];
myFilters.push(myBevel);
}
oInstance.filters = myFilters;
}
trace ("locH "+oInstance._x +" locV " + oInstance._y);
trace("opacity :" + oInstance._alpha);
//Восстановление рамеров окна
this._xscale = 100;
this._yscale = 100;
back._x = 500;
back._y = 100;
back._width = pWidth;
back._height =pHeight;
back._xscale = 100;
back._yscale=100;
//_level0._height = 128;
trace(back._width +" "+back._height)
//this.PlaceBitmaps();
trace("gotoAndStop");
gotoAndStop(3);
}
splitD = function (str, delimiter) {
//trace("splitting...");
str = str.split (delimiter[0]);
if (delimiter.length > 1) {
for (var i = 0; i < str.length; i++) {
if (str[i].indexOf (delimiter[1]) != -1) {
str[i] = splitD (str[i], delimiter.slice (1));
}
}
}
return str;
}
Добавлено через 4 часа 17 минут Самое интересное - что такие трудности возникоют только с подгруженными картинками.. с битмапом, образованным из текста все в порядке... Последний раз редактировалось alex_blackout; 26.03.2009 в 15:46. |
|
|||||
|
Цитата:
oInstance._rotation = pRotation; oInstance._width = pWidth; oInstance._height= pHeight; проверте: oInstance._rotation = 0; oInstance._width = pWidth; oInstance._height= pHeight; oInstance._rotation = pRotation; Особо не вникал в код, это первое, что в глаза бросилось, но, по-моему, ошибка здесь |
|
|||||
|
Регистрация: Mar 2009
Сообщений: 29
|
Фуууф..
![]() Спасибо ОГРОМНОЕ.. работает ![]() |
![]() |
![]() |
Часовой пояс GMT +4, время: 23:52. |
|
|
« Предыдущая тема | Следующая тема » |
|
|