Wednesday, September 08, 2010

Viewing Category


Flash and DNN

 

    02

    Ngữ cảnh ở đây là từ trang HTML/ascx, mình nhúng 1 file swf và có truyền tham số cho nó. Mình đã mất khá nhiều thời gian cho thằng này. T_T Nhưng cuối cùng cũng đã thành công. ^_^

    Đầu tiên, mình xin trình bày cách gọi và truyền tham số tới file swf trên HTML trước đã. Thực sự mình đã search khá nhiều cho vụ truyền tham số này. Có nhiều cách được trình bày trên mạng nếu bạn search với từ khóa pass parameter to swf file in HTML. Bực 1 cái là chẳng có 1 full example code để nó chạy cả. Còn chạy các đoạn code mà nó đưa thì lại chẳng thấy chạy gì cả. Bực cả mình với nó. Cuối cùng, may mắn cũng đến với anh. Và đây là code của nó. Chỉ thêm 1 chút so với việc hiển thị swf file bình thường.
    <!-- saved from url=(0014)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Photo Viewer</title>
    <script src="AC_OETags.js" language="javascript"></script>
    <style>
    body { margin: 0px; overflow:hidden }
    </style>
    <script language="JavaScript" type="text/javascript">
    <!--
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // -->
    </script>
    </head>
     
    <body scroll="no">
    <script language="JavaScript" type="text/javascript" src="history.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
    var hasProductInstall = DetectFlashVer(6, 0, 65);
     
    // Version check based upon the values defined in globals
    var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
     
     
    // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
    if ( hasProductInstall && !hasRequestedVersion ) {
          // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
          // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
          // DO NOT MODIFY THE FOLLOWING FOUR LINES
          // Location visited after installation is complete if installation is required
          var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
          var MMredirectURL = window.location;
        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
        var MMdoctitle = document.title;
     

    [Read the rest of this article...]

    Posted in: Flash and DNN
    27

    Trước khi nói về việc hiển thị file Flash trên Dotnetnuke page, mình sẽ nói về cách hiển thị Flash trên 1 trang HTML.

    Sẽ có nhiều cách với nhiều đoạn code ví dụ mẫu để hiển thị trên 1 trang HTML mà bạn có thể tìm kiếm trên mạng. Do mình sử dụng Flex Builder để build 1 Flex project và đưa ra ouput là 1 file HTML có nhúng file swf, nên mình sử dụng HTML code của nó:
    <!-- saved from url=(0014)about:internet -->
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Photo Viewer</title>
    <script src="AC_OETags.js" language="javascript"></script>
    <style>
    body { margin: 0px; overflow:hidden }
    </style>
    <script language="JavaScript" type="text/javascript">
    <!--
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // -->
    </script>
    </head>

    [Read the rest of this article...]

    Posted in: Flash and DNN
    01
    Hôm nay, mình sẽ viết 1 bài về cách chạy 1 Flash trên module DNN. Ở đây, Flash application chỉ dừng ở mức độ độc lập, không có liên kết với file bên ngoài.
    Cũng giống như cách chạy ứng dụng Flash trên 1 trang HTML thông thường, ta cần khai báo đối tượng object, truyền các parameter thích hợp.
     
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="220" height="220" id="alert_example" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="alert_example.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />
    <embed src="/DNNWorking1/Portals/0/alert_example.swf" quality="high" bgcolor="#ffffff" width="220" height="220" name="alert_example" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
     
    Trên đây là 1 ví dụ về cách khai báo. Hãy đặt chúng trong trang .ascx. Khi viết code, chỉ cần lưu ý kĩ về cách khai báo đường dẫn tới file swf. Có thể đặt file trong thư mục Portals giống như ở ví dụ trên ="/DNNWorking1/Portals/0/alert_example.swf. Hoặc có thể đặt nó trong module của chúng ta: /DucMinhNguyen/DesktopModules/MyHotNewsModule/alert_example.swf.
     
    <embed width="284" height="148" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/DucMinhNguyen/DesktopModules/MyHotNewsModule/alert_example.swf" play="true" loop="true" menu="true"></embed>
     
    Ngoài ra, còn có cách khác đó là insert HTML code lên module Text/HTML. Để dùng cách này, ta cần phải dùng upload file swf bằng cách dùng FckEditor. Ở trong HTML code, cần xác định đúng đường dẫn tới file này.
    Cách để chạy Flash trên DNN module cũng khá đơn giản, đúng không? Mình sẽ cố gắng nghiên cứu việc chạy ứng dụng Flash có tương tác với bên ngoài như đọc file xml chẳng hạn. Nó sẽ khó khăn hơn khi phải xác định được đường dẫn tới các file bên ngoài.

     

    [Read the rest of this article...]

    Posted in: Flash and DNN
    HomeTrangITForum
    Copyright 2010 by Nguyễn Minh ĐứcDesigned by DyNNamiteTerms Of UsePrivacy Statement