A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash MX '#initclip' action

  1. #1
    Member
    Join Date
    Mar 2001
    Posts
    71

    Flash MX '#initclip' action

    I understand that '#initclip' is a "Flash MX only" action, but I was wondering if there was an "equal action" in Flash 5. I'm trying to make this PayPal component work in Flash 5 and the only syntax error that comes up is this '#initclip' action.

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Posts
    177
    Sorry, there is no equivalent in Flash 5.
    New Book: Robert Penner's Programming Flash MX
    Dynamic tweening, color, math, vectors and physics with OOP ActionScript
    http://www.robertpenner.com/profmx
    http://www.amazon.com/exec/obidos/AS...bertpennerc-20

  3. #3
    Member
    Join Date
    Mar 2001
    Posts
    71
    OK, thanks for the response Robert, here's the code. . . is there any way to this code could be re-done or converted to be Flash 5 compliant?

    this.ppType._visible = false;
    this.SIPText._visible = false;
    //assign associated object buttonPress() method
    this._parent[this._targetInstanceName].onPress = PayPalSubmit;

    function PayPalSubmit() {
    getURL("https://www.paypal.com/cgi-bin/webscr?return="+escape(pp_return), "_self", "POST");
    }

    #initclip 3
    function SIP_Button() {
    return;
    }

    // business variable manipulation
    function SIP_SetBus(theBus) {
    this.business = theBus;
    }
    function SIP_GetBus() {
    return (this.business);
    }
    // item_name variable manipulation
    function SIP_SetItemName(theName) {
    this.item_name = theName;
    }
    function SIP_GetItemName() {
    return (this.item_name);
    }
    // item_number variable manipulation
    function SIP_SetItemNumber(theNumber) {
    this.item_number = theNumber;
    }
    function SIP_GetItemNumber() {
    return (this.item_number);
    }
    // amount variable manipulation
    function SIP_SetAmount(theAmount) {
    this.amount = theAmount;
    }
    function SIP_GetAmount() {
    return (this.amount);
    }
    // shipping variable manipulation
    function SIP_SetShipping(theShipping) {
    this.shipping = theShipping;
    }
    function SIP_GetShipping() {
    return (this.shipping);
    }
    // shipping2 variable manipulation
    function SIP_SetExtraShipping(theShipping) {
    this.shipping2 = theShipping;
    }
    function SIP_GetExtraShipping() {
    return (this.shipping2);
    }
    // handling variable manipulation
    function SIP_SetHandling(theHandling) {
    this.handling = theHandling;
    }
    function SIP_GetHandling() {
    return (this.handling);
    }
    // image_url variable manipulation
    function SIP_SetImageURL(theURL) {
    this.image_url = theURL;
    }
    function SIP_GetImageURL() {
    return (this.image_url);
    }
    // pp_return variable manipulation
    function SIP_SetReturnURL(theReturn) {
    this.pp_return = theReturn;
    }
    function SIP_GetReturnURL() {
    return (this.pp_return);
    }
    // cancel_return variable manipulation
    function SIP_SetCancelURL(theURL) {
    this.cancel_return = theURL;
    }
    function SIP_GetCancelURL() {
    return (this.cancel_return);
    }
    // undefined_quantity variable manipulation
    function SIP_SetUpdatableQuantity(theBoolean) {
    if (theBoolean)
    this.undefined_quantity = "1";
    else
    this.undefined_quntity = "0";
    this.undefined_quntity = undefined_quntity;
    }
    function SIP_GetUpdatableQuantity() {
    if (this.undefined_quantity=="1") {
    return true;
    }
    return false;
    }
    // no_shipping variable manipulation
    function SIP_SetNoShipping(theBoolean) {
    if (theBoolean)
    this.no_shipping = "1";
    else
    this.no_shipping = "0";
    this.no_shipping = no_shipping;
    }
    function SIP_GetNoShipping() {
    if (this.no_shipping=="1") {
    return true;
    }
    return false;
    }
    // no_note variable manipulation
    function SIP_SetAllowNote(theBoolean) {
    if (theBoolean)
    this.no_note = "0";
    else
    this.no_note = "1";
    this.no_note = no_note;
    }
    function SIP_GetAllowNote() {
    if (this.no_note=="0") {
    return true;
    }
    return false;
    }

    function SIP_Submit() {
    this._parent[this._targetInstanceName].onPress();
    }

    SIP_Button.prototype.setBusiness = SIP_SetBus;
    SIP_Button.prototype.getBusiness = SIP_GetBus;

    SIP_Button.prototype.setItemName = SIP_SetItemName;
    SIP_Button.prototype.getItemName = SIP_GetItemName;

    SIP_Button.prototype.setItemNumber = SIP_SetItemNumber;
    SIP_Button.prototype.getItemNumber = SIP_GetItemNumber;

    SIP_Button.prototype.setAmount = SIP_SetAmount;
    SIP_Button.prototype.getAmount = SIP_GetAmount;

    SIP_Button.prototype.setShipping = SIP_SetShipping;
    SIP_Button.prototype.getShipping = SIP_GetShipping;

    SIP_Button.prototype.setExtraShipping = SIP_SetExtraShipping;
    SIP_Button.prototype.getExtraShipping = SIP_GetExtraShipping;

    SIP_Button.prototype.setHandling = SIP_SetHandling;
    SIP_Button.prototype.getHandling = SIP_GetHandling;

    SIP_Button.prototype.setImageURL = SIP_SetImageURL;
    SIP_Button.prototype.getImageURL = SIP_GetImageURL;

    SIP_Button.prototype.setReturnURL = SIP_SetReturnURL;
    SIP_Button.prototype.getReturnURL = SIP_GetReturnURL;

    SIP_Button.prototype.setCancelURL = SIP_SetCancelURL;
    SIP_Button.prototype.getCancelURL = SIP_GetCancelURL;

    SIP_Button.prototype.setUpdatableQuantity = SIP_SetUpdatableQuantity;
    SIP_Button.prototype.getUpdatableQuantity = SIP_GetUpdatableQuantity;

    SIP_Button.prototype.setNoShipping = SIP_SetNoShipping;
    SIP_Button.prototype.getNoShipping = SIP_GetNoShipping;

    SIP_Button.prototype.setAllowNote = SIP_SetAllowNote;
    SIP_Button.prototype.getAllowNote = SIP_GetAllowNote;

    SIP_Button.prototype.buyNow = SIP_Submit;
    Object.registerClass("PP_BuyNow",SIP_Button)
    #endinitclip 3

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Posts
    177
    I created a Flash 5 version of Object.registerClass()--it can't do everything that MX can, but it helps:

    Code:
    // create functions if in Flash 5
    if ( getVersion().indexOf(" 5,") != -1 ) {
    
    Object.registerClass = function (symbolID, theClass) {
    	if (symbolID == undefined || arguments.length < 2) return false;
    	var ac = arguments.callee;
    	if (ac.registry == undefined) ac.registry = new Object();
    	if (theClass.prototype == null) delete ac.registry[symbolID];
    	else ac.registry[symbolID] = theClass;
    	return true;
    };
    
    MovieClip.prototype.useClass = function (theClass, initObject) {
    	for (var i in initObject) this[i] = initObject[i];
    	var cProto = theClass.prototype;
    	if (cProto != null && cProto != MovieClip.prototype) {
    		this.__proto__ = cProto;
    		this.$base = theClass;
    		this.$base ();
    		delete this.$base;
    	}
    };
    
    MovieClip.prototype.$sysAttachM = MovieClip.prototype.attachMovie;
    
    MovieClip.prototype.attachMovie = function (symbolID, newName, depth, initObject) {
    	this.$sysAttachM (symbolID, newName, depth);
    	this[newname].useClass (Object.registerClass.registry[symbolID], initObject);
    };
    
    MovieClip.prototype.$sysDupMC = MovieClip.prototype.duplicateMovieClip;
    
    MovieClip.prototype.duplicateMovieClip = function (newName, depth, initObject) {
    	this.$sysDupMC (newName, depth);
    	_parent[newname].useClass (this.__proto__.constructor, initObject);
    };
    
    // hide methods from for..in loops
    ASSetPropFlags (MovieClip.prototype, ["useClass", "$sysAttachM", "$sysDupMC"], 1);
    
    } // end if
    New Book: Robert Penner's Programming Flash MX
    Dynamic tweening, color, math, vectors and physics with OOP ActionScript
    http://www.robertpenner.com/profmx
    http://www.amazon.com/exec/obidos/AS...bertpennerc-20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center