如何创建的ActionScript3警报对话框?

编程入门 行业动态 更新时间:2024-10-28 04:27:31
本文介绍了如何创建的ActionScript3警报对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用ActionScript 3.0在Flash专业版(CS5)的一个项目。我想创建一个确认框。如果我使用Flex SDK,我可以使用的在 mx.controls使用包快递类。然而,似乎没有类似的控制存在于标准的Flash图书馆和谷歌搜索的任何数量只是让我flex参考。

I'm working on a project with Actionscript 3.0 in Flash Pro (CS5). I want to create a confirmation box. If I were using the Flex SDK I could do this using the Alert class in the mx.controls package. However, it seems that no similar control exists in the standard Flash library and any amount of Googling just leads me to Flex references.

推荐答案

试试这个类

package com.whatever { //Imports import flash.display.Shape; import flash.display.Sprite; import flash.geom.Rectangle; import flash.events.MouseEvent; //Class public class AlertBox extends Sprite { //Vars protected var box:Shape; protected var yesBtn:Sprite; //Constructor public function AlertBox($:Rectangle):void { //Initialise box = new Shape() yesBtn = new Sprite() addChild(box) addChild(yesBtn) //Render with (box.graphics) { lineStyle(1) beginFill(0, 0.4) drawRect($.x, $.y, $.width, $.height) endFill() } with (yesBtn.graphics) { lineStyle(1, 0x00FF00) beginFill(0x00FF00, 0.4) drawRect($.x+$.width-100, $.y$.height-40, 80, 20) endFill() } //Events yesBtn.addEventListener(MouseEvent.CLICK, yesClickHandler, false, 0, true) yesBtn.addEventListener(MouseEvent.MOUSE_OVER, yesOverHandler, false, 0, true) } //Handlers protected function yesClickHandler($):void {} protected function yesOverHandler($):void {}

更多推荐

如何创建的ActionScript3警报对话框?

本文发布于:2023-11-23 15:33:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621964.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   对话框

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!