Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loading images on custom control events.

New Here ,
Jul 17, 2017 Jul 17, 2017

var LOADER:mx.controls.Loader;

LOADER.load("download.png");

var nextFileNameAbsol:String;

var i:Number;

var j:Number;

var fileNameAbsol:String;

var fileName:String;

var fileArray:Array;

fileName="version_01\\battery_0001.png" ;

//my_txt3.htmlText="<img src=\"download.png\">";

//trace("In main");

//

//trace(this.mySlider.ratio);

//

//trace("In main1");

//trace(this.ratio);

//

//trace("In main2");

//

//trace(mySlider.ratio);

//my_txt3.htmlText="<img src=\"download.png\">";

this.onMouseDown==function(){

trace("OnMD");

ratio.text=this.mySlider.ratio;

trace("in main ratio");

trace(this.mySlider.ratio);

//changeHandler();

//changeHandler1();

//my_txt3.htmlText="<img src=\"download.png\">";

my_txt3.htmlText="<img src=\"download.png\">";

};

this.onMouseMove==function(){

trace("OnMM");

ratio.text=this.mySlider.ratio;

trace("in main ratio");

trace(this.mySlider.ratio);

//changeHandler();

//changeHandler1();

//my_txt3.htmlText="<img src=\"download.png\">";

my_txt3.htmlText="<img src=\"download.png\">";

};

this.onKeyDown==function(){

trace("OnKD");

ratio.text=this.mySlider.ratio;

trace("in main ratio");

trace(this.mySlider.ratio);

//changeHandler();

//changeHandler1();

//my_txt3.htmlText="<img src=\"download.png\">";

my_txt3.htmlText="<img src=\"download.png\">";

};

this.onLoad=function(){

trace("Onload");

ratio.text=this.mySlider.ratio;

trace("in main ratio");

trace(this.mySlider.ratio);

//changeHandler();

//changeHandler1();

//my_txt3.htmlText="<img src=\"download.png\">";

//my_txt3.htmlText="<img src=\"download.png\">";

};

this.onEnterFrame=function(){

//ratio.text=this.mySlider.ratio;

//

//trace("in main ratio");

//trace(this.mySlider.ratio);

//changeHandler();

//changeHandler1();

//my_txt3.htmlText="<img src=\"download.png\">";

LOADER.load("download.png");

my_txt3.htmlText="<img src=\"download.png\">";

};

//stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

//

//

//stage.scaleMode=StageScaleMode.NO_SCALE;

//

//

//stage.align=StageAlign.TOP_LEFT;

function changeHandler1():Void {

trace("FCH");

j=this.mySlider.ratio;

fileNameAbsol= fileName.substr(0 ,(fileName.length-4));

trace(fileNameAbsol);

nextFileNameAbsol=generateName(fileNameAbsol,j);

trace(nextFileNameAbsol);

nextFileNameAbsol=nextFileNameAbsol+".png";

trace(nextFileNameAbsol);

fileName = nextFileNameAbsol;

trace(nextFileNameAbsol);

fileArray=nextFileNameAbsol.split("\\");

//my_txt3.htmlText="<img src=\"download.png\">";

//my_txt3.htmlText=htmlImage;

}

function changeHandler():Void {    

j=this.mySlider.ratio;

fileNameAbsol= fileName.substr(0 ,(fileName.length-4));

trace(fileNameAbsol);

nextFileNameAbsol=generateName(fileNameAbsol,j);

trace(nextFileNameAbsol);

nextFileNameAbsol=nextFileNameAbsol+".png";

trace(nextFileNameAbsol);

fileName = nextFileNameAbsol;

trace(nextFileNameAbsol);

fileArray=nextFileNameAbsol.split("\\");

var htmlImage:String;

htmlImage="\"   <img src='";

htmlImage+=fileArray[0];

htmlImage+="/";

//htmlImage+="\\\\";

htmlImage+=fileArray[1];

//

htmlImage+="' ";

htmlImage+="height=\"42\" width=\"42\"";

htmlImage+=" />    \"";

//

//htmlImage+="' />    \"";

//my_txt3.htmlText="<img src=\"download.png\">";

//my_txt3.htmlText="<img src=\"download.png\">";

trace("html im");

trace(htmlImage);

my_txt3.htmlText="<img src=\"download.png\">";

//my_txt3.htmlText=htmlImage;

}

function leadingZeros(theNumber:Number):String{

var ourString:String = String(theNumber);

for(var i:Number = 4-ourString.length; i > 0; i--){

ourString = "0"+ourString;

}

return ourString;

}

function generateName(fileName:String,end:Number):String{

var fileNameRet:String;

var len:Number;

var nameEnd:Number;

var stringPart:String;

var stringPartNum:Number;

var stringPartNumRet:String;

var returnStringInipart:String;

var returnString:String;

trace("before ss");

trace(fileName);

stringPart=fileName.substr((fileName.length-4) ,(fileName.length-1));

trace("after ss");

trace(fileName);

stringPartNum=Number(stringPart);

stringPartNum++;

stringPartNumRet=leadingZeros(j);

returnStringInipart=fileName.substr(0 ,(fileName.length-4));

trace("returnStringInipart");

trace(returnStringInipart);

trace("stringPartNumRet");

trace(stringPartNumRet);

returnStringInipart=returnStringInipart+stringPartNumRet;

trace("returnStringInipart after cat");

trace(returnStringInipart);

return returnStringInipart;

}

In the above code, i want to load images to the LOADER as I use the mySlider.

mySlider Code :

//this.onEnterFrame=function(){

// ratio.text=mySlider.ratio;

// trace("tracing OS");

// trace(mySlider.ratio);

//

//}

onClipEvent (load) {

//mySound = new Sound();

// mySound.loadSound("sound2.mp3", false);

ratio.text=mySlider.ratio;

ratio.text=parent.mySlider.ratio;

ratio.text="RAM";

  trace("onClipEvent load this ");

trace(this.mySlider.ratio);

trace("onClipEvent load parent ");

trace(parent.mySlider.ratio);

}

onClipEvent (enterFrame) {

//downloaded = mySound.getBytesLoaded();

// total = mySound.getBytesTotal();

// if (downloaded != total) {

_root.dl = "downloading song...";

//} else {

// complete = 1;

// _root.dl = "";

// }

}

The code in mySlider:

this.ratio=0;

dragger.onPress=function(){

//trace("drag");

this.startDrag(true,0,0,line._width,0);

this.onEnterFrame=function(){

ratio=Math.round(this._x) ;

//trace("ratio");

trace(ratio);

}

}

dragger.onRelease=dragger.onreleaseOutside=stopDrag;

( The is a horizontal line  'Line ' and vertical 'dragger' Movieclip.

How can i achieve this.

TOPICS
ActionScript
403
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2017 Jul 17, 2017
LATEST

where's the problem?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines