Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,288 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,248 people online right now. Registration is fast and FREE... Join Now!




how to set font-family and opacity of text background in dynamic flash

 
Reply to this topicStart new topic

how to set font-family and opacity of text background in dynamic flash

shweta.honey25
post 25 Sep, 2008 - 10:12 PM
Post #1


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15

CODE

var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("slideshow.xml");
myGalleryXML.onLoad = function() {

_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.Image_width = myGalleryXML.firstChild.attributes.Image_width;

_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;

_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;

_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;
createContainer();
createMask();
callThumbs();
scrolling();
callFullImage(0);
var _CurrentNumber:Number;
_CurrentNumber=1;

var maxCount:Number;
maxCount = 0;
};


function callThumbs() {
_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
container_mc._x = _root.gallery_x;
container_mc._y = _root.gallery_y;

var clipLoader = new MovieClipLoader();
var preloader = new Object();
clipLoader.addListener(preloader);
maxCount = 0;
for (i=0; i<myImagesTotal; i++) {
thumbURL = myImages[i].attributes.thumb_url;
maxCount = int(maxCount+1);
myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth() );
myThumb_mc._x = (_root.Image_width)*i;
myThumb_mc._alpha = 70;
myThumb_mc.swapDepths(100);
clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);

preloader.onLoadStart = function(target) {
target.createTextField("my_txt",target.getNextHighestDepth,0,0,100,20);
target.my_txt.selectable = false;

};

preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

preloader.onLoadComplete=function(target){
new Tween(target, "_alpha", Regular.easeIn, 0, 100, .5, true);
target.my_txt.removeTextField();

target.onRelease=function(){
callFullImage(this._name);
_CurrentNumber=int(this._name);
}

target.onRollOver=function(){
this._alpha=100;
};

target.onRollOut=function(){
this._alpha=80;
};
}
}
}

/***********************************thumbs end*****************/





function callFullImage(myNumber) {

myURL = myImages[myNumber].attributes.full_url;
//trace(myImages[myNumber].childNodes[0]);
myTitle = myImages[myNumber].childNodes[0].firstChild.nodeValue;

_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
fullImage_mc._x = _root.full_x;
fullImage_mc._y = _root.full_y;
fullImage_mc.swapDepths(getNextHighestDepth);

var fullClipLoader = new MovieClipLoader();
var fullPreloader = new Object();
fullClipLoader.addListener(fullPreloader);

fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",fullImage_mc.getNextHighestDepth,0,0,600,500);
target.my_txt.selectable = false;
};

fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
};

fullPreloader.onLoadComplete = function(target) {
new Tween(target, "_alpha", Regular.easeIn, 0, 40, 100, true);
target.my_txt.text = myTitle;
target.my_txt.textColor = 0xCFCFCF;
target.my_txt.html = true;
target.my_txt.label.condenseWhite= true;
target.my_txt.wordWrap= true;
target.my_txt._height = 50;
target.my_txt.autoSize = true;
target.my_txt.multiline = true;
target.my_txt.background = true;
target.my_txt.backgroundColor = 0x212121;

};


fullClipLoader.loadClip("Images/"+myURL,fullImage_mc);

}
/***********************full Images end*******************************/

function createMask() {

_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());

mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;

mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);

container_mc.setMask(_root.mask_mc);

}
/*******************************mask end*****************************************/
function scrolling() {

_root.onEnterFrame = function() {
if (mask_mc._xmouse<(mask_mc._width/2) || mask_mc._xmouse>(mask_mc._width)) {
container_mc._x += Math.cos(((mask_mc._xmouse)/mask_mc._width)*Math.PI)*10;
if (container_mc._x>mask_mc._x) {
container_mc._x = mask_mc._x;
}
if (container_mc._x<(mask_mc._x-(container_mc._width-mask_mc._width))) {
container_mc._x = mask_mc._x-(container_mc._width-mask_mc._width);
}
}
};
}

import mx.transitions.Tween;
import mx.transitions.easing.*;


btnNext.onRelease= function()
{
    //trace(_CurrentNumber);
    _CurrentNumber=int(_CurrentNumber+1);
    if(int(_CurrentNumber+1)>int(maxCount))
    {
        _CurrentNumber=0;
        //trace(maxCount);
    }
    callFullImage(_CurrentNumber);
    
}
btnPrev.onRelease= function()
{
    //trace(_CurrentNumber);
    _CurrentNumber=int(_CurrentNumber-1);
    if(int(_CurrentNumber)<0)
    {
        _CurrentNumber=0;
        //trace(maxCount);
    }
    callFullImage(_CurrentNumber);
    
}





i make a flash of images slider but i have problem is that to set the text's background opacity.how to set font family also






User is offlineProfile CardPM

Go to the top of the page

pemcconnell
post 26 Sep, 2008 - 02:03 AM
Post #2


D.I.C Regular

Group Icon
Joined: 5 Aug, 2008
Posts: 394



Thanked 35 times

Dream Kudos: 75
My Contributions


embed the font-family using the properties
User is offlineProfile CardPM

Go to the top of the page

shweta.honey25
post 26 Sep, 2008 - 03:54 AM
Post #3


New D.I.C Head

*
Joined: 15 Sep, 2008
Posts: 15

QUOTE(pemcconnell @ 26 Sep, 2008 - 03:03 AM) *

embed the font-family using the properties



all the text is disappear . i embed the font........
CODE
target.my_txt.textColor = 0xffffff;
target.my_txt.embedFonts = true;
target.my_txt.antiAliasType = "advanced";
target.my_txt.selectable = false;
var newTxt:TextFormat = new TextFormat();
newTxt.font = "Font";
target.my_txt.setTextFormat(newTxt);
User is offlineProfile CardPM

Go to the top of the page

DilutedImage
post 28 Sep, 2008 - 05:05 PM
Post #4


D.I.C Addict

Group Icon
Joined: 20 Nov, 2006
Posts: 642



Thanked 6 times

Dream Kudos: 25
My Contributions


Create a font object in your library, 'Export for ActionScript', and then set your text field's font to the font object.

User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 01:11AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month