Skip to main content
November 5, 2011
Question

One css for phone, one css for tablet : how ?

  • November 5, 2011
  • 2 replies
  • 717 views

Hi

Here is my problem : i'm able to detect if the my mobile application run on a tablet or on a phone by calculating the diagonal of the stage

But then, i need to load the good css : the smarphone.css or the tablet.css

I try by compiling css as swf, BUT the problem : iOS doesn't permit to load external swf and in this case, smartphone.swf or tablet.swf are external swf

So my needs is to switch the css at runtime, but not by loading external swf

I try with <fx:Style source.myStateTablet="" /> but it's not possible

Any ideas ?

Thanks

Sebastien

This topic has been closed for replies.

2 replies

November 6, 2011

Why not have both layouts in the file and then just direct the user to which ever one makes sense based on what the screen size is? Different frames or scenes.

November 7, 2011

Hi

Actually my css is like that :

tablet.css :

components|Header

{

    skinClass: ClassReference("com.zapmeeting.zinfotv.skins.tablet.header.HeaderSkin");

}

smartphone.css :

components|Header

{

    skinClass: ClassReference("com.zapmeeting.zinfotv.skins.mobile.header.HeaderSkin");

}

In fact, I use css juste to reference skinClass and so apply a skin

So your idea is to make juse one css, called main.css and then paste in the above code ?

components|Header

{

    skinClass: ClassReference("com.zapmeeting.zinfotv.skins.tablet.header.HeaderSkin");

}

components|Header

{

    skinClass: ClassReference("com.zapmeeting.zinfotv.skins.mobile.header.HeaderSkin");

}

but how redirect the user to the correct skinClass ?

could I insert a state query like :

components.tablet|Header

{

    skinClass: ClassReference("com.zapmeeting.zinfotv.skins.tablet.header.HeaderSkin");

}

where tablet and smartphone are two states ?