Flex中如何在mx:Style中用@font-face,在Flash SWF中嵌入字体

 

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  3.         layout="vertical"
  4.         verticalAlign="middle"
  5.         backgroundColor="white"
  6.         applicationComplete="init()">
  7.     <mx:Script>
  8.         <![CDATA[
  9.             private function init():void {
  10.                 var appInfo:LoaderInfo = Application.application.loaderInfo;
  11.                 /* Just grab the filename from the SWF URL. */
  12.                 var fileName:String = (appInfo.url).split("/").pop();
  13.                 /* Convert bytes to kilobytes. */
  14.                 var kbTotal:String = (appInfo.bytesTotal / 1024).toFixed(2);
  15.                 info.text = fileName + " (" + kbTotal + "kb)";
  16.             }
  17.         ]]>
  18.     </mx:Script>
  19.     <mx:Style>
  20.         @font-face{
  21.             src: url('./fonts/fromFlash.swf');
  22.             fontFamily: "Myriad Web Pro";
  23.         }
  24.         .myriadWebProFromSWF {
  25.             fontFamily: "Myriad Web Pro";
  26.             fontSize: 24;
  27.         }
  28.     </mx:Style>
  29.     <mx:ApplicationControlBar dock="true">
  30.         <mx:Label id="info" />
  31.     </mx:ApplicationControlBar>
  32.     <mx:Text styleName="myriadWebProFromSWF">
  33.         <mx:text>The quick brown fox jumped over the lazy dog.</mx:text>
  34.     </mx:Text>
  35. </mx:Application>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要使上述CSS样式适应手机设备,您可以使用媒体查询来调整样式和布局。以下是在现有代码添加媒体查询以适应手机设备的示例: ```css .page { /* 桌面样式 */ display: flex; flex-direction: column; align-items: flex-start; width: 375px; height: 812px; background-color: #000000; font-family: Roboto-Regular; white-space: nowrap; } .view { /* 桌面样式 */ position: relative; display: flex; flex-direction: column; align-items: flex-start; margin-top: 100px; margin-left: 52px; } .caption { /* 桌面样式 */ position: relative; overflow: hidden; height: 45px; max-width: 192px; font-family: Roboto-Bold; font-size: 32px; line-height: 45px; color: #ffffff; text-overflow: ellipsis; } .title { /* 桌面样式 */ position: relative; margin-top: 4px; font-size: 32px; line-height: 38px; color: #c3c3c3; } .item-wrapper { /* 桌面样式 */ position: relative; display: flex; justify-content: center; align-items: flex-start; margin-top: 69px; margin-left: 33px; white-space: normal; } .item { /* 桌面样式 */ width: 294px; height: 287px; } .book-wrapper { /* 桌面样式 */ position: relative; display: flex; align-items: center; align-self: flex-end; height: 49px; padding-left: 20px; padding-right: 20px; margin-top: 128px; margin-right: 50px; line-height: 20px; border-radius: 10px; box-sizing: border-box; border-width: 1px; border-style: solid; border-color: rgba(196, 196, 196, 1); } .book { /* 桌面样式 */ font-size: 20px; color: #ffffff; } button { /* 桌面样式 */ background-color: transparent; border-style: none; } /* 手机样式 */ @media (max-width: 480px) { .page { width: auto; height: auto; padding: 10px; } .view { margin-top: 50px; margin-left: 20px; } .caption { height: auto; max-width: none; font-size: 24px; line-height: 30px; text-overflow: initial; } .title { margin-top: 2px; font-size: 24px; line-height: 30px; } .item-wrapper { margin-top: 40px; margin-left: 20px; } .item { width: auto; height: auto; max-width: 100%; max-height: none; } .book-wrapper { margin-top: 80px; margin-right: 20px; } .book { font-size: 16px; } } ``` 在上述示例,我们添加了一个媒体查询以应用适应手机设备的CSS样式。媒体查询的条件是最大宽度为480像素,这意味着当浏览器宽度小于或等于480像素时,将应用手机样式。在手机样式,我们对各个元素进行了调整,以适应手机屏幕的大小和布局。 请注意,这只是一个示例,您可以根据您的具体需求和设计进行进一步的调整和优化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值