A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Really simple problem (probably?!)

  1. #1
    Member
    Join Date
    Jul 2009
    Posts
    43

    Really simple problem (probably?!)

    Hi,
    Firstly, let me say that I've no idea about Flash at all. I'm a lot more comfortable programming php or sql.

    However, I'm trying to edit an .fla that I use on my website. I've managed to edit some of the actionscript (it's not that far away from php so easy enough to edit etc). but I've still got a small change that I'm stuck on and I wondered if someone could point me in the right direction.

    On my swf I have some 'tabs' at the top of the swf that have some text on them. I want to change the colour of the text via a variable that I'll pass to the swf on loading.

    I've already passed a variable to the script to change the background colour of the tab but I've no idea where the text colour is stored (or referenced).

    Here's the code (bear in mind this is just a small part of the overall code but it's all in it's own section so I think this is everything that relates to the 'tabs').

    Code:
    gradStart.cacheAsBitmap = gradMask.cacheAsBitmap=true;
    gradStart.setMask(gradMask);
    
    //var tabArray:Array = new Array("Memorial", "Remembrance Book", "Slideshow", "Tribute Wall");
    var tabArray:Array = new Array("Memorial", "Slideshow");
    
    tabContainer.createEmptyMovieclip("tabArea");
    
    for (i=0; i<tabArray.length; i++) {
    	var myTab = tabContainer.attachMovie("tabClip", "tabClip"+i, tabContainer.getNextHighestDepth(), {_x:i*112});
    	myTab.caption = tabArray[i];
    	myTab.onRollOver = function() {
    		//this.nextFrame();
    	};
    	myTab.onRollOut = function() {
    		//this.prevFrame();
    	};
    	myTab.onRelease = function() {
    		//this.prevFrame();
    		this.enabled = false;
    		render_tabs(this);
    		_root.close_all();
    
    		switch (this.caption) {
    			case "Memorial" :
    				_root.render_rotator();
    				break;
    			case "Slideshow" :
    				_root.gallery_swf.open_gallery();
    				break;
    		}
    	};
    
    // ***** I'VE MANAGED TO PASS IN MY VARIABLES INTO colourArray
    // ***** THE TAB BACKGROUND COLOUR IS IN colourArray[4]
    // ***** THE TAB TEXT COLOUR IS IN colourArray[3]
    // ***** MY QUESTION IS:- HOW DO I FIND OUT WHERE THE TAB TEXT
    // ***** COLOUR IS SET ???
    
    	var tabColor = new Color(myTab.tabShape);
    	tabColor.setRGB(_root.background_swf.colourArray[4]);
    }
    
    function render_tabs(currentTab) {
    	myString = currentTab+"";
    	myCurrent = myString.substr(-1, 1);
    	//trace(myCurrent);
    
    	if (currentTab == null) {
    		myCurrent = 0;
    	}
    
    	for (i=0; i<tabArray.length; i++) {
    		myTab = tabContainer["tabClip"+i];
    
    		if (i != myCurrent) {
    			myTab.nextFrame();
    			myTab.enabled = true;
    		} else {
    			myTab.gotoAndStop(1);
    			myTab.enabled = false;
    		}
    	}
    }
    render_tabs();
    I've added some comments to show you where I've already made a change.

    I've dug around in the software and found a 'tab' object that has some text on it that just says "caption". This text gets dynamically altered at runtime to read the contents of the array (ie. Memorial and Slideshow).

    How would I change the text colour for this 'tab'?

    Has anyone any ideas on this.

    My sincere apologies if I've not given you enough information. Due to my lack of knowledge of Flash I'm really struggling on how to forumulate the question with enough information to get an answer. I just hope someone can point me in the right direction.

    I really appreciate any help you can give me on this.

    Cheers

    John ;-)

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    That code is AS2. I'll move it to the correct forum for you.

  3. #3
    Member
    Join Date
    Jul 2009
    Posts
    43
    Apologies for putting it in the wrong section 5T. Thanks for moving it for me. ;-)

    Cheers

    John :-)

  4. #4
    Member
    Join Date
    Jul 2009
    Posts
    43
    Just another note...
    If anyone needs the .fla file to help with this then just let me know and I'll send it over. I'm thinking that the answer will be that either the 'tab' property has a set text color that can be set with something like:
    Code:
    var tabTextColor = new Color(myTab.tabText);
    tabTextColor.setRGB(_root.background_swf.colourArray[3]);
    .... or.... will the actual tab text on the 'graphic page' (ie the main page of the swf - not the actionscript window - please forgive my terminology as I'm really not familiar with Flash at all) have a dynamic property whereby you can set the 'text colour' to equal a variable ??

    Thanks again for all your ideas and help

    John ;-)

  5. #5
    Member
    Join Date
    Jul 2009
    Posts
    43
    Please see my other thread http://board.flashkit.com/board/show...35#post4291735

    I've attached screenshots to this thread to try and illustrate my point more clearly. Many thanks

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center