作者存档: amyflash - 第12页

air项目里面加入浏览器功能的解决方案

adobe官方方案,适用于比较老旧的页面加载,主要用到Htmlloader或者stagewebview类,如果要支持现代h5的页面,民间给出两个ane扩展解决方案,一个是https://github.com/RayGyoe/ANEWinWebView(待验证,缺点只支持win,而且需要提前安装Miniblink的轻量浏览器?根据经验在部分air sdk可能有崩溃现象,AIR29正常。AIR30、31多次添加会崩溃。貌似是air sdk问题?),还有一个https://github.com/tuarua/WebViewANE(已验证,代码下面给出,缺点窗口好像不能多开)
上代码:

//优点:支持h5,缺点:不能多开?
//github:https://github.com/tuarua/WebViewANE
import com.tuarua.FreSharp;
import com.tuarua.FreSwift;
import com.tuarua.WebView;
import com.tuarua.webview.Settings;

import flash.desktop.NativeApplication;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.utils.setTimeout;
import flash.events.MouseEvent;
import flash.text.TextField;

var freSharpANE:FreSharp = new FreSharp(); // must create before all others
var freSwiftANE:FreSwift = new FreSwift(); // must create before all others
var webView:WebView;
var hasActivated:Boolean;
//stage.displayState=StageDisplayState.FULL_SCREEN;//全屏显示
//stage.scaleMode=StageScaleMode.SHOW_ALL;//显示所有,不保证比例





gjbtn.addEventListener(MouseEvent.CLICK,doTest);
function doTest(e:MouseEvent):void
{

    stage.displayState=StageDisplayState.FULL_SCREEN;//全屏显示
    stage.scaleMode=StageScaleMode.SHOW_ALL;//显示所有,不保证比例
    //newWindow.maximize();
    newWindow.activate();
    newWindow.restore();

    newWindow.addEventListener(MouseEvent.CLICK,gotClick);
}


function gotClick(e:MouseEvent):void{
trace("click"); 
    }

this.addEventListener(Event.ACTIVATE, onActivated);
/*stage.addEventListener(Event.RESIZE, onResize);
function onResize(e:flash.events.Event):void
{
    if (newWindow){
    newWindow.bounds = new Rectangle((this.stage.stageWidth-1920)/2, (this.stage.stageHeight-840)/2, 1920, 840);
    }
}*/

function onActivated(event:Event):void {
        if (hasActivated) return;

        setTimeout(init, 0); // this is handle the HARMAN splash screen
        hasActivated = true;

}


var newWindow:NativeWindow;

function doDrag(e:MouseEvent):void{
        newWindow.startMove();

}




function init():void {


    var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
//  windowOptions.transparent = true;
    //windowOptions.systemChrome = NativeWindowSystemChrome.NONE;
  windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
    windowOptions.type =  NativeWindowType.NORMAL;
    newWindow = new NativeWindow(windowOptions);

    //newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
    //newWindow.stage.align =StageAlign.;// StageAlign.TOP_LEFT;
    //newWindow.title = "title name";
    newWindow.bounds = new Rectangle((this.stage.stageWidth-1920)/2, (this.stage.stageHeight-840)/2, 1920, 840);
    newWindow.stage.color=0x000066;
    newWindow.stage.align=StageAlign.TOP_LEFT;
    newWindow.activate();

    var titlebar:Wintitle = new Wintitle();
    titlebar.addEventListener(MouseEvent.MOUSE_DOWN,doDrag);


    newWindow.stage.addChild(titlebar);

    var x1:Number = 0;//(this.stage.stageWidth-1920)/2;
    var y1:Number = 40;//(this.stage.stageHeight-840)/2;

    NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExiting);
    var viewport:Rectangle = new Rectangle(x1,y1, 1920, 800);
      //  var settings:Settings = new Settings();
    webView = WebView.shared();
    webView.init(newWindow.stage, viewport, new URLRequest("http://baidu.com"), null, 1, 0xFFF1F1F1);

    webView.visible = true;


    newWindow.minimize();
}


function onExiting(event:Event):void
{
        WebView.dispose();
        FreSwift.dispose();
        FreSharp.dispose();
}


//只支持非h5页面
package
{
    import flash.display.Sprite;
    import flash.events.KeyboardEvent;
    import flash.events.LocationChangeEvent;
    import flash.geom.Rectangle;
    import flash.media.StageWebView;
    import flash.ui.Keyboard;
    import flash.events.Event;

    public class TestStageWebView extends Sprite
    {
        private var webView:StageWebView = new StageWebView();
        public function TestStageWebView()
        {
            addEventListener(Event.ADDED_TO_STAGE, onStageHandler); 

        }

        private function onStageHandler(e:Event):void
        {
            webView.stage = this.stage;
            webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight );
            //webView.loadURL( "http://www.baidu.com" );
            webView.loadURL( "http://31.15.5.4:9080/#/pageList/pageViewPreview?id=712083a1-0e5a-42c4-bf88-d4c2c79105bd&mode=share" );

            webView.addEventListener( Event.COMPLETE, htmlLoaderComplete );
            webView.addEventListener( LocationChangeEvent.LOCATION_CHANGING, locationChanging);
        }

        private function htmlLoaderComplete ( eve : Event ) : void
        {
            trace( "网页加载完成!" );
        }

        private function locationChanging ( eve : Event ) : void
        {
            trace( "网页加载!" );
        }   
    }
}
//只支持非h5页面
package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.LocationChangeEvent;
    import flash.events.MouseEvent;
    import flash.html.HTMLLoader;
    import flash.net.URLRequest;

    public class TestHtmlLoader extends Sprite
    {
        private var host:CustomHost;
        private var htmlLoader: HTMLLoader;
        public function TestHtmlLoader()
        {
            super();            
            addEventListener(Event.ADDED_TO_STAGE, onStageHandler);         
        }

        private function onStageHandler(e:Event):void
        {
            this.stage.addEventListener(Event.RESIZE,onResizeHandler);      

            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            htmlLoader = new HTMLLoader();

            htmlLoader2 = new HTMLLoader();
            setHTMLLoader();



        }

        private function onResizeHandler(e:Event):void
        {
            htmlLoader.width = stage.stageWidth/2;
            htmlLoader.height = stage.stageHeight;  

            htmlLoader2.width = stage.stageWidth/2;
            htmlLoader2.height = stage.stageHeight; 
            htmlLoader2.x = stage.stageWidth/2;
        }

        private function setHTMLLoader () : void
        {
            htmlLoader.addEventListener( Event.COMPLETE, htmlLoaderComplete );
            htmlLoader.addEventListener( LocationChangeEvent.LOCATION_CHANGING, locationChanging);


            htmlLoader.width = 1080;
            htmlLoader.height = 670;
            htmlLoader.load( new URLRequest("https://fwdt.gzw.sh.cegn.cn/r/w?cmd=com.awspaas.user.apps.datamanager_html&appId=com.awspaas.user.apps.fundplatform&html=proShow_td1.html&sid=ck") );
            addChild( htmlLoader );

            host = new CustomHost();
            htmlLoader.htmlHost = host;

            htmlLoader2.x = 1920;
            htmlLoader2.width = 1920;
            htmlLoader2.height = 670;
            htmlLoader2.load( new URLRequest("http://www.bing.com/") );
            addChild(htmlLoader2);
            //host2 = new CustomHost();
            //htmlLoader2.htmlHost = host;


        }

        private function htmlLoaderComplete ( eve : Event ) : void
        {
            trace( "网页加载完成!" );
        }

        private function locationChanging ( eve : Event ) : void
        {
            trace( "网页加载!" );
        }


        private var htmlLoader2: HTMLLoader;


    }
}

//只支持非h5页面
package
{
    import flash.html.HTMLHost;
    import flash.html.HTMLLoader;
    import flash.display.NativeWindow;
    import flash.display.NativeWindowInitOptions;
    import flash.display.StageScaleMode;
    import flash.geom.Rectangle;
    import flash.text.TextField;

    public class CustomHost extends HTMLHost
    {
        import flash.html.*;
        public var statusField:TextField;
        public function CustomHost(defaultBehaviors:Boolean=true)
        {
            super(defaultBehaviors);
        }
        override public function windowClose():void
        {
           // htmlLoader.stage.window.close();
        }
        override public function createWindow(windowCreateOptions:HTMLWindowCreateOptions):HTMLLoader
        {
            var initOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
            var window:NativeWindow = new NativeWindow(initOptions);
            window.visible = true;
            var htmlLoader2:HTMLLoader = new HTMLLoader();
            htmlLoader2.width = window.width;
            htmlLoader2.height = window.height;
            window.stage.scaleMode = StageScaleMode.NO_SCALE;
            window.stage.addChild(htmlLoader2);
            return htmlLoader2;
        }
        override public function updateLocation(locationURL:String):void
        {
            trace(locationURL);
        }        
        override public function set windowRect(value:Rectangle):void
        {
            htmlLoader.stage.nativeWindow.bounds = value;
        }
        override public function updateStatus(status:String):void
        {
            statusField.text = status;
        }        
        override public function updateTitle(title:String):void
        {
            htmlLoader.stage.nativeWindow.title = title + "- Example Application";
        }
        override public function windowBlur():void
        {
            htmlLoader.alpha = 0.5;
        }
        override public function windowFocus():void
        {
            htmlLoader.alpha = 1;
        }
    }
}

animate文本滚动条组件

import fl.controls.UIScrollBar;
import fl.controls.ScrollBarDirection;
var url2:String="https://amyflash.com";
var uLdr:URLLoader=new URLLoader(new URLRequest(url2));
uLdr.addEventListener(Event.COMPLETE, completeHandler);
var tf:TextField = new TextField();
tf.width=320;
tf.height=140;
tf.x=10;
tf.y=10;
tf.border=true;
tf.multiline=true;
tf.wordWrap=false;
addChild(tf);
/*
    如果只需要垂直方向滚动条,那么先设置tf.wordWrap=true,然后不要添加水平滚动条即可。
*/
//水平滚动条
var hScrollBar:UIScrollBar = new UIScrollBar();
hScrollBar.direction=ScrollBarDirection.HORIZONTAL;
hScrollBar.move(tf.x, tf.y + tf.height);
hScrollBar.width=tf.width;//一定要设置和文本框一样宽,不然不美观
hScrollBar.scrollTarget=tf;
addChild(hScrollBar);
//垂直滚动条
var vScrollBar:UIScrollBar = new UIScrollBar();
vScrollBar.direction=ScrollBarDirection.VERTICAL;
vScrollBar.move(tf.x + tf.width, tf.y);
vScrollBar.height=tf.height;//一定要设置和文本框一样高,不然不美观
vScrollBar.scrollTarget=tf;
addChild(vScrollBar);
function completeHandler(event:Event):void {
    tf.text=event.target.data;
    hScrollBar.update();
    vScrollBar.update();
}

Adobe Animate ReferenceError:错误#1069:在_上找不到属性loopMode,并且没有默认值

当我向Adobe Animate 2019中的MovieClip添加.as类时遇到以下错误:
Adobe Animate ReferenceError:错误#1069:在_上找不到属性loopMode,并且没有默认值
相同的项目适用于早期版本的Animate或flash而不会出错..as文件没什么特别之处.
solution:
打开”高级图层”时会发生此问题.您必须关闭”高级图层”才能在项目中使用某些代码.

1.转到stage的属性面板.

2.单击”高级设置”.

3.取消选中”使用高级图层”模式.

4.单击确定.

air创建一个新窗口

import flash.display.NativeWindowInitOptions;
import flash.display.NativeWindowSystemChrome;
import flash.display.NativeWindowType;
import flash.display.NativeWindow;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.geom.Rectangle;

var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
windowOptions.type = NativeWindowType.NORMAL;

var newWindow:NativeWindow = new NativeWindow(windowOptions);
newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
newWindow.stage.align = StageAlign.TOP_LEFT;
newWindow.bounds = new Rectangle(200, 200, 800, 800);

newWindow.activate();

参考:https://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/display/NativeWindow.html#NativeWindow()

animatecc添加sdk

打开animatecc,在管理->帮助->管理adobesdk->+,添加sdk路径

adobe air runtime下载:https://airsdk.harman.com/runtime
adobe air sdk下载:https://airsdk.harman.com/

air添加和使用ane

1、用animate cc 新建一个air 项目;
2、打开文件—actionScript设置—库路径—点击(浏览到本机扩展(ANE)文件)—找到我们生成的那个ANE文件
3、愉快的引用该ane中的类即可
ane github:https://github.com/tuarua/WebViewANE
示例:

package {
import com.tuarua.FreSharp;
import com.tuarua.FreSwift;
import com.tuarua.WebView;
import com.tuarua.webview.Settings;

import flash.desktop.NativeApplication;

import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.net.URLRequest;
import flash.utils.setTimeout;

[SWF(width="1024", height="768", frameRate="60", backgroundColor="#F1F1F1")]
public class WebViewExampleAS3 extends Sprite {
    private var freSharpANE:FreSharp = new FreSharp(); // must create before all others
    private var freSwiftANE:FreSwift = new FreSwift(); // must create before all others
    private var webView:WebView;
    private var hasActivated:Boolean;

    public function WebViewExampleAS3() {
        this.addEventListener(Event.ACTIVATE, onActivated);
    }

    protected function onActivated(event:Event):void {
        if (hasActivated) return;
        setTimeout(init, 0); // this is handle the HARMAN splash screen
        hasActivated = true;
    }

    protected function init():void {
        NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExiting);
        var viewport:Rectangle = new Rectangle(0, 0, 1024, 768);
        var settings:Settings = new Settings();
        webView = WebView.shared();
        webView.init(stage, viewport, new URLRequest("https://html5test.com"), settings, 1, 0xFFF1F1F1);
        webView.visible = true;
    }
    private function onExiting(event:Event):void {
        WebView.dispose();
        FreSwift.dispose();
        FreSharp.dispose();
    }
}
}

mysql报错:Column count of mysql.proc is wrong. Expected 21, found 20

今天尝试将一个数据库从本地使用navicat工具同步到服务器时,收到mysql的报错:
Column count of mysql.proc is wrong. Expected 21, found 20

解决方案:
mysql_upgrade -u root -p

MySQL查看数据库表容量大小

原文链接:https://blog.csdn.net/fdipzone/article/details/80144166
4.查看指定数据库各表容量大小
例:查看mysql库各表容量大小
select table_schema as 'dbname',table_name as 'tname',table_rows as 'recordnum',truncate(data_length/1024/1024, 2) as 'size(MB)',truncate(index_length/1024/1024, 2) as 'indexsize(MB)' from information_schema.tables where table_schema='dbname' order by data_length desc, index_length desc;

3.查看指定数据库容量大小
例:查看mysql库容量大小
select table_schema as 'dbname', sum(table_rows) as 'recordnum', sum(truncate(data_length/1024/1024, 2)) as 'dbsize(MB)', sum(truncate(index_length/1024/1024, 2)) as 'indexsize(MB)' from information_schema.tables where table_schema='dbname';

发现一个宝藏

为信仰而赞👍
http://www.11ria.com/
http://annie2x.com/

mariadb密码忘记的解决方案

修改/opt/lampp/etc/my.cnf
[mysqld]下面添加这行,就可以跳过密码验证进入mysql数据库,修改好密码后,记得改回来即可
skip-grant-tables

vim /opt/lampp/phpmyadmin/config.inc.php 修改密码可以让phpmyadmin网页版可以访问