| |||||||
Du magst keine Werbung? Wir auch nicht!
Einfach registrieren und die Werbung ist weg. Diese Nachricht sehen nur nicht registrierte Nutzer.
![]() |
| | LinkBack | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| i ate pixels Registriert seit: Mar 2004 Ort: Augsburg
Beiträge: 526
|
hi habe mit den dispatchern ein problem. hab mir schon viele tutorials durchgelesen usw. klappt aber alles noch nicht wie ich will. ich hab ne kleine alertbox class geschrieben da mir die alerts von flash du umständlich zu skinnen sind. problem liegt in zeile 65 hier die class Code: import flash.filters.DropShadowFilter
import mx.events.EventDispatcher
class as.vorbilder.alertbox extends mx.core.UIComponent {
//var titleText:String;
//var copyText:String;
function dispatchEvent() {
};
function addEventListener() {
};
function removeEventListener() {
};
function alertbox() {
mx.events.EventDispatcher.initialize(this);
}
function callAlertBox(copyText:String,titleText:String) {
/// Events
var myThis = this
/// create empty movieclip for the alertbox
var mc:MovieClip = _root.createEmptyMovieClip("alertbox", _root.getNextHighestDepth());
/// attach bg image
mc.attachMovie("alertbox_bg", "bg", 1)
with (mc.bg) {
_x -= _width / 2
_y -= _height / 2
}
/// attach close Button
mc.bg.attachMovie("alertbox_closeButton", "closeButton", 2)
/// attach main button
mc.bg.attachMovie("alertbox_mainButton", "mainButton", 3)
/// create title
mc.bg.createTextField("title", 4, 0, 0, 200, 50)
/// create copytext
mc.bg.createTextField("copy", 5, 0, 0, 200, 50)
/// adjusting position of alertbox
mc._x = Stage.width / 2
mc._y = Stage.height / 2
/// adjust position of closebutton
mc.bg.mainButton._x = 162
mc.bg.mainButton._y = 86
/// adjust position of mainbutton
mc.bg.closeButton._x = mc.bg._width - 46
mc.bg.closeButton._y = -12
/// mainbutton click
mc.bg.mainButton.onPress = function() {
this.gotoAndStop(2)
dispatchEvent({type:"closeAlert", target:this})
}
mc.bg.mainButton.onRelease = function() {
this.gotoAndStop(1)
}
mc.bg.mainButton.onReleaseOutside = function() {
this.gotoAndStop(1)
}
/// mainbutton actions
/// set text&style of title
mc.bg.title.text = titleText
mc.bg.title.antiAliasType = "advanced"
mc.bg.title.sharpness = 50
mc.bg.title.border = false
mc.bg.title.embedFonts = true
mc.bg.title.selectable = false
mc.bg.title.autoSize = true
var titleFormat:TextFormat = new TextFormat()
titleFormat.font = "Georgia"
titleFormat.size = 19
titleFormat.color = 0xc72f0a
mc.bg.title.setTextFormat(titleFormat)
/// adjust position of title
mc.bg.title._x = 15
mc.bg.title._y = 14
/// set text&style of copytext
mc.bg.copy.text = copyText
mc.bg.copy.antiAliasType = "advanced"
mc.bg.copy.sharpness = -50
mc.bg.copy.border = false
mc.bg.copy.embedFonts = true
mc.bg.copy.selectable = false
mc.bg.copy.autoSize = true
var copyFormat:TextFormat = new TextFormat()
copyFormat.font = "Georgia"
copyFormat.size = 13
copyFormat.color = 0x757575
mc.bg.copy.setTextFormat(copyFormat)
/// adjust position of copytext
mc.bg.copy._x = 15
mc.bg.copy._y = 37
/// apply drop shadow
var filter:DropShadowFilter = new DropShadowFilter(0,90, 0x000000, 0.25,10, 10, 1, 3, false, false, false);
var filterArray:Array = new Array();
filterArray.push(filter);
mc.bg.filters = filterArray;
/// startanimation
var popIn:mx.transitions.Tween = new mx.transitions.Tween(mc, "_xscale", mx.transitions.easing.Elastic.easeOut, 80, 100, .3, true)
popIn.onMotionChanged = function () {
mc._yscale = mc._xscale
}
}
} Code: ///// pop ups
import mx.managers.PopUpManager
import as.vorbilder.*
function callAlert () {
var alert:alertbox = new alertbox()
// new object we can use for a listener
var alertListener:Object = new Object;
// method definition for the drawn event
alertListener.closeAlert = function(evtObj) {
alertObj.deletePopUp()
trace(alertObj)
trace("schliessen")
}
// subscribe myListnerObj to mySquareObject
alert.addEventListener("closeAlert",alertListener);
alertObj.PopUpManager.createPopUp(_root, alert.callAlertBox(), true);
}
bt.onPress = function () {
callAlert()
} das das this bei dem dispatcher nicht stimmen kann ist mir klar. habe schon jegliches targeting ausprobiert. komme aber einfach nicht weiter. wäre dankbar für jede hilfe. des weiteren frag ich mich warum ich in einer klasse keine funktion aufrufen kann wenn etwas in einer Code: MovieClip.onPress = function () {
...
} grüße
__________________ GTA ähnliches Auto mit HTML, CSS3 + JavaScript |
| | |
| | #2 (permalink) | ||
| voidboy Registriert seit: Sep 2004 Ort: München
Beiträge: 5.588
| Zitat:
Zitat:
Suche hier einfach mal nach delegate, | ||
| | |
![]() |
| Lesezeichen |
| Themen-Optionen | |
| Ansicht | |
| |