Trouble with Flex 3 styles not fully applying to dynamically generated tabs within a TabNavigator

When using ActionScript to dynamically create a tab, I noticed that the style is applied to the skins but not to the text of the newly created tab until I click on another tab and then go back to it.

ActionScript

private function clickAddTabHandler(event:Event):void{
   var vbox:VBox = new VBox;
   var tab:Canvas = new (Canvas);
   vbox.label = "Select Location";
   vbox.addChild(tab);
   tabBar.addChild(vbox);
   tabBar.selectedIndex = tabBar.numChildren-1;
  }

MXML

<mx:TabNavigator id="tabBar" width="100%" height="100%" tabStyleName="tabNavigator" selectedTabTextStyleName="tabNavigatorSelected" tabHeight="19">

CSS

.tabNavigator
{
   disabledSkin: Embed(source="assets/skins/TabBar-tab_disabledSkin.png",
    scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   downSkin: Embed(source="assets/skins/TabBar-tab_downSkin.png",
   scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   overSkin: Embed(source="assets/skins/TabBar-tab_overSkin.png",
   scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   upSkin: Embed(source="assets/skins/TabBar-tab_upSkin.png",
   scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   selectedDisabledSkin: Embed(source="assets/skins/TabBar-tab_selectedDisabledSkin.png",
       scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   selectedUpSkin: Embed(source="assets/skins/TabBar-tab_selectedUpSkin.png",
       scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   selectedOverSkin: Embed(source="assets/skins/TabBar-tab_selectedUpSkin.png",
       scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   selectedDownSkin: Embed(source="assets/skins/TabBar-tab_selectedUpSkin.png",
       scaleGridTop=1, 
       scaleGridLeft=20, 
       scaleGridBottom=18, 
       scaleGridRight=32);
   textAlign: left; 
   paddingLeft: 20; 
   paddingRight: 20; 
   fontSize: 11; 
   fontFamily: Helvetica Neue; 
   color: #FFFFFF;
   textRollOverColor: #FFFFFF;
}

.tabNavigatorSelected
{
   textAlign: left; 
   paddingLeft: 20; 
   paddingRight: 20; 
   fontSize: 11; 
   fontFamily: Helvetica Neue; 
   color: #135F9E; 
   textRollOverColor: #135F9E; 
   textSelectedColor: #135F9E;
}

Answer №1

When working with CSS, I highly recommend utilizing a style explorer tool. Personally, it has always been beneficial in achieving the correct styles for my projects.

Check out this helpful style explorer tool here

Additionally, remember to use the "Code Sample" button or indent your code with 4 spaces for better formatting. This will greatly improve readability for everyone.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The div element nested within the button is not visible

Fiddle I am trying to create a unique social button design that resembles the custom Google+ sign-in button: However, I encountered an issue where the second div element (to hold the right part of the button) is not displaying as expected: Here is the c ...

Wordpress is having issues running jQuery

I've developed a function inside js/custom.js. The purpose of this function is to arrange posts in my Wordpress site by applying a class called articleAlign. This class will enhance the spacing between the article title and its excerpt, but only when ...

Recalling the position of the uploaded image within a v-for loop

I am struggling to solve this issue. Currently, I am utilizing Vue.js in an attempt to construct a dashboard where users can upload up to five images of visitors who are authorized to access a specific service provided by the user. Below is the code snip ...

Adjust the dimensions of the canvas without disrupting the existing artwork

I am currently working on a pixel art application where I am facing an issue with saving images from the canvas. The saved image appears small and pixelated when I try to resize it. I would like to resize the image to larger dimensions, but I am unsure of ...

Creating input fields similar to the Mail app on OSX

Is there a way to create input fields similar to those in the Mail App on OSX? Take a look at this screenshot - I'm looking to group text as shown in the image above. Instead of having multiple individual input fields (e.g. like in the mail app for ...

Various image dimensions cause divs to shift unevenly

Here is the current setup: <div class="row"> <div class="col-md-4 content-column"> <img class="btn-center btn-desktop" src="images/buttons/btn-desktop.svg" alt="desktop button"> <h2 class="btn-deskt ...

CSS Opacity Issue

Why is the article transparent? Despite my efforts to search online for similar instances, I am surprised at not finding anything and feeling quite puzzled about what steps to take next. body { background-color: #000000; opacity: 0.8; background-i ...

Sustaining the hover effect background color when hovering over submenu options

I am currently working on a navigation menu that includes list items a, b, c, d, e, f. One issue I am facing is when a user hovers over the list item d, the submenu items like d1, d2, d3, d4, and d5 appear within the d section. However, the background col ...

Step-by-step guide on achieving rounded borders with a gap:

Struggling to design blocks and elements with rounded corners that have a gap between the corner and the straight line. It's proving to be quite challenging :) Additionally, I need to create buttons that look like this, and If CSS alone doesn' ...

Why use @media (max-width:-1) in your code?

While reviewing CSS code created by another department, I noticed an interesting media descriptor: @media (max-width:-1) { ...standard css stuff here } The value of max-width cannot be less than 0, so what could be the purpose of this? Perhaps it was ...

Styling HTML elements using CSS within PHP echo statements

I am a beginner when it comes to PHP and I'm trying to figure out how to style this table. I tried creating a class, but changing the styles in a separate CSS file didn't work for me. Should I use style tags? How should I go about styling this? ...

How can I disable auto-fill for password input fields? Setting autocomplete="off" doesn't seem to be working

Hey there, I'm having some trouble with the autocomplete feature in Google Chrome. Can anyone suggest an alternative way to disable autocomplete for password fields? By the way, my project is using Vue.js. ...

Learn how to set up webpack or Next.js to generate a CSS file from custom Material styles and automatically inject it into the header

One of the things I've done is define some custom material styles, like this: import {createStyles, makeStyles, Theme} from '@material-ui/core/styles'; export const useStyles = makeStyles((theme: Theme) => createStyles({ fab ...

Utilize React Material UI Slider to dynamically adjust Border Radius in your web design

Utilizing React Material UI's components like the slider and button is essential for this project. The main objective is to dynamically change the border radius of the button using the value obtained from the slider. However, there seems to be a chall ...

The contents within the div element exceed the width of its parent element

Hey there, I'm currently working on a Rails application to showcase some links in a horizontal layout. The links are indeed displaying horizontally without wrapping, just as intended. However, I've noticed that the containing div is wider than th ...

Make sure the text fits perfectly without any extra spaces

When working with CSS/HTML, I noticed that using a simple text within a div without any margin or padding, and specifying a font-size of 36px with a line-height also set to 36px doesn't fit perfectly - there is always some spacing at the top of the li ...

Having trouble resizing divisions using three.js?

Three.js is an incredible library that offers thorough documentation and functions perfectly. I am currently attempting to display a plane with trackball control inside a div that resizes according to the window or browser size. However, I am encountering ...

The alignment of the navigation menu disrupts the functionality of the dropdown sub-menus

I'm finding it challenging to center the navigation menu while maintaining the functionality of the drop-down li elements. Here is my demo: http://jsbin.com/tosayosino/1/edit?html,css,js,output Removing the float:left; property from .jetmenu li succ ...

Use percentages for the width in CSS and pixels for the height, ensuring that both dimensions are equal

I'm attempting to create a square that adjusts its size according to the screen size. Currently, I have the width set to 25%. Is there a way to ensure that the height remains the same length in pixels as the width? Appreciate any assistance on this ...

Animate the border to move to the next list item after it is hovered over

Seeking assistance to animate border-bottom movement in navbar Desiring animation effect for hover event on second li item The code for the navbar is as follows: .top-bar { background:#0d0d0d; width:100%; height:85px; position:fixed; top:0; z-index:99 ...