0

I have an old Adobe Animate project and I want to add a feedback scene at the end which will require the user to send an email with their feedback. In order for this to work I have to place my project in a server and I used Xampp, I placed the whole project in htdocs folder. When I tried to open it in localhost the files are downloaded instead of opening them. I also tried to publish the project to html format and when I opened it in local host it asked for adobe flash player and I don't have it and Adobe ended it. so I can't download it. I tried other software that work like adobe flash player but none worked for me. Is there a possible way I can run my project in localhost. Any suggestion is appreciated.

I also Know that adobe animate now works on HTML, CSS and JavaScript. But the project that I have is big and I don't have the time to change all ActionScript coding to JS. I hope there is a way I can run my project in Xampp.

This is the code I'm using to send email

php File

<?php

$emailTo = "abcd@gmail.com";
$name = $_POST["name"];
$emailFrom = $_POST["email"];
$message = $_POST["message"];
$subject = "New Message from Yourwebsite!";

if( !empty( $_POST ) ) {
    $body  = "Name: " . $name . "\n\n";
    $body .= "Email: " . $emailFrom . "\n\n";
    $body .= "Message:\n" . $message;
    $body  = wordwrap($body, 70);
    $header = "From: " . $emailFrom . "\nReply-To: " . $emailFrom. "\n\n";
    
    if( mail( $emailTo, $subject, $body, $header ) ) {
        echo( "result=Successful" );
        
    } else {
        echo( "result=Unsuccessful" );
    }
}
?>

ActionScript Code


import fl.managers.StyleManager;

StyleManager.setStyle("textFormat", new TextFormat("Verdana", 11, 0x000000));
const SENDING:String      = "Sending";
const SENT_SUCCESS:String = "Successful";
const SENT_FAILED:String  = "Unsuccessful";
var tmr:Timer;

function resetTextFields():void {
    name_txt.text    = "";
    email_txt.text   = "";
    message_txt.text = "";
}

function resetContactForm():void {
    submit_btn.enabled  = true;
    feedback_mc.visible = false;
    clearErrors();
}

function afterTmrWait(evt:TimerEvent):void {
    tmr.stop();
    tmr.removeEventListener(TimerEvent.TIMER, afterTmrWait);
    resetContactForm();
}

function validateEmail(str:String):Boolean {
    var pattern:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
    var result:Object = pattern.exec(str);
    if(result == null) {
        return false;
    }
    return true;
}

function submitForm(evt:MouseEvent):void {
    clearErrors();

    var passChecks:Boolean = true;  

    if(name_txt.text.length < 1) {
        nameError_mc.visible = true;
        passChecks = false;
    }
    if(!validateEmail(email_txt.text)) {
        emailError_mc.visible = true;
        passChecks = false;
    }
    if(message_txt.text.length < 1) {
        messageError_mc.visible = true;
        passChecks = false;
    }

    if(passChecks) {
        submit_btn.enabled  = false;
        feedback_mc.visible = true;
        feedback_mc.gotoAndStop(SENDING);

        var urlVars:URLVariables = new URLVariables();
        var urlReq:URLRequest    = new URLRequest("send_email.php");
        var ldr:URLLoader        = new URLLoader();

        urlVars.name    = name_txt.text;
        urlVars.email   = email_txt.text;
        urlVars.message = message_txt.text;
        urlReq.data     = urlVars;
        urlReq.method   = URLRequestMethod.POST;
        ldr.addEventListener(Event.COMPLETE, serverFeedback);
        ldr.load(urlReq);
    }
}

function serverFeedback(evt:Event):void {
    var ldr:URLLoader = evt.target as URLLoader;
    var urlVars:URLVariables = new URLVariables(ldr.data);

    if(urlVars.result == SENT_SUCCESS) {
        feedback_mc.gotoAndStop(SENT_SUCCESS);
        resetTextFields();
    } else if(urlVars.result == SENT_FAILED) {
        feedback_mc.gotoAndStop(SENT_FAILED);
    }
    
    tmr = new Timer(3000, 1);
    tmr.addEventListener(TimerEvent.TIMER, afterTmrWait);
    tmr.start();
}

function clearErrors():void {
    nameError_mc.visible    = false;
    emailError_mc.visible   = false;
    messageError_mc.visible = false;
}

submit_btn.addEventListener(MouseEvent.CLICK, submitForm);

resetTextFields();
resetContactForm();

I get these error messages I don't know if the issue is actually from these error because when I run the scene itself the scene looks fine but when I test it as whole even though it's just one scene it doesn't work properly just the same way it appears when I used ruffle and at the beginning I thought it's perhaps because ruffle does not support my project. But may it's because of these errors

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at fl.controls::TextArea/drawLayout()
    at fl.controls::TextArea/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/drawNow()
    at fl.controls::ScrollBar/draw()
    at fl.controls::UIScrollBar/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::LabelButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/drawNow()
    at fl.controls::ScrollBar/draw()
    at fl.controls::UIScrollBar/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::LabelButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::BaseButton/draw()
    at fl.core::UIComponent/callLaterDispatcher()
TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/addChildAt()
    at fl.controls::BaseButton/drawBackground()
    at fl.controls::LabelButton/draw()
    at fl.controls::Button/draw()
    at fl.core::UIComponent/callLaterDispatcher()


r2000_na
  • 49
  • 7
  • There are far too many problems in a single question, so I suggest focusing on the main one: before anything else you need to actually be able to run Flash applications in your browser. Look through 3-4 pages of **flash** and **actionscript-3** questions, there are at least few about the same problem and resolved one way or another: https://stackoverflow.com/questions/tagged/flash and https://stackoverflow.com/questions/tagged/actionscript-3 – Organis Aug 20 '21 at 14:26
  • What is the final or intended output format of your game? Is it for mobile (_eg:_ APK) or desktop (_eg:_ EXE)? Basically you cannot run SWF in browser so you must export your project as a native app (not SWF) and have your AS3 app call your PHP script – VC.One Aug 26 '21 at 01:31

0 Answers0