Facebook Login Handler doesn't get fired in Flex4 Facebook API - actionscript-3

I have literally spent HOURS trying to solve this mystery... but simply can't seem to get hold of it.
I am using the same code lines (literally!) as the example here (official adobe tutorial) and I get different result.
protected function login():void
{
Facebook.login(loginHandler,{perms:"user_birthday,read_stream,publish_stream"});
}
protected function loginHandler(success:Object,fail:Object):void
{
trace ("login handler called");
if(success){
currentState="state_home";
Facebook.api("/me",getMeHandler);
//userImg.source=Facebook.getImageUrl(success.uid,"small");
Facebook.api("/me/statuses",getStatusHandler);
}
}
Everything works fine, i.e. everything till it is time to fire the loggedin event. I get asked to log in and all permissions are asked correctly. After I log myself in to facebook, the loggedin event doesn't fire. Is there any way of solving this problem??
And I am really desparate... :(

Have you tried debugging the JavaScript of the containing HTML page? I've found that the JavaScript can encounter errors in the communication back to your Flash movie, and it fails silently in the background.
Open the debugger and have a look for any errors - sometimes its down to conflicting embed object Ids in the HTML that throws it.

Related

DataVizExtention: issue with clearing viewables while a sprite is selected

In my code, I have this workflow:
When user wants to see some things, add Sprites using 'DataVizCore.addViewables()'
Use 'viewer.addEventListener(DataVizCore.MOUSE_CLICK, onDotClick)' to show info bubble
When user wants to show other things, call 'DataVizCore.removeAllViewables()' to clear Sprites
Repeat from step 1
This sequence works OK except in one situation.
If a sprite was selected (by clicking on it) before removeAllViewables() is called, I don't get MOUSE_CLICK event for newly added Sprites. In browser console, I see following error is thrown.
CustomViewables.js:318 Uncaught TypeError: Cannot read property 'style' of undefined at ViewableData.getViewableUV (developer.api.autodesk.com/modelderivative/v2/viewers/7.*/extensions/DataVisualization/DataVisualization.js:454)
As a workaround, I added 'event.hasStopped = true' to click event handler to prevent Sprite getting selected internally. That seems to work.
This seems like a bug in DataVizExtension to me. Or, my workflow is wrong?
Thanks
Bandu
Bandu. Thanks for the detailed steps to reproduce this issue. I tried with v7.46.0 version of the DataVisualization.js (latest as of my message) but was not seeing the same issue. I'd be curious if you are using this same version of the Forge Viewer (you can figure that out by looking at the viewer3D.js fetched under the Network tab of Chrome DevTools).
Setting event.hasStopped = true works because it internally avoided the code path calls into getViewableUV that threw the exception, but the flag is meant for other use cases (e.g. overriding default sprite selection behavior).
In any case, I've just tweaked our internal code to make use-cases like yours more robust. The changes will be released with the upcoming v7.47.0. Thank you for your feedback 🙂

Chromecast - sender app - Cast icon not visible HTML5/JS

The problem is that cast icon is not visible even in sample examples by Google in sender application. Month ago i had to refresh the page couple of times to get an icon back or restart the device. Now nothing is working and the icon is missing but in chrome development tools it shows that it is correctly implemented. Do you know what is the problem?
I am creating cast button by:
google-cast-launcher
there are no errors in console
PS. I do also have had implemented the library
https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1
I found a solution. You need to use https:// instead of http://
otherwise the cast icon wont be visible
I hope it helps some of you
#edit
if you have problem with not showing icon and in console it shows :
CastVideos.js:125 Uncaught ReferenceError: cast is not defined
at CastPlayer.initializeCastPlayer (CastVideos.js:125)
at window.__onGCastApiAvailable (CastVideos.js:1004)
at chrome.cast.ha (VM1365 cast_sender.js:99)
in your html put script at the beggining of head and script to framework gstatic at the end of body.
You have to delay the initialization of Cast Player
let castPlayer = new CastPlayer();
window['__onGCastApiAvailable'] = function (isAvailable) {
if (isAvailable) {
setTimeout(() => {
castPlayer.initializeCastPlayer();
}, 1000)
}
};

Actionscript ExternalInterface syntax error

I have created a simple container app whose purpose is to:
play an embedded flv by clicking a button onscreen
activate an external interface call (this records the fact that the person has watched the video)
That's it.
I have it working partially. I have a button on scene 1 with the "click and go to next scene" code snippet attached to it. I click it and it happily moves on to scene 2 where the flv video plays beautifully. The problem happens when I try to insert the code that the external developer told me to use to make the connection between my flash file and IT's back end work.
Here is the recommended code:
ExternalInterface.call("recordScore()”);
Unfortunately, as soon as I enter this code, there is a syntax error and the movie no longer plays. I added the code on a frame at the end of the movie.
I am no sure that the syntax the developer sent was correct, nor do I know where to insert this code into the proper place.
It looks like there is a closed double quotes (”) in what you pasted:
ExternalInterface.call("recordScore()”);
Assure quotation marks, and you do not need the () on the JavaScript function you're calling:
ExternalInterface.call("recordScore");
When running from Flash Projector (as in Ctrl+Enter), you can test whether External Interface is available; otherwise, an exception is thrown at runtime:
if (ExternalInterface.available) {
ExternalInterface.call("recordScore");
}
Fortunately, I found some code in the former employee's files that seems to have worked:
ExternalInterface.call
(
"recordScore()"
);
Hopefully this will connect with the database and resolve the issue so I can go back to making videos.
Thank you so much for your help!
Regards!

ArgumentError: Error #2109: Frame label default not found in scene default

I have asked this question on the http://www.actionscript.org/ forums, I have yet to get a reply, so I will try here as well, I will copy the post from those forums, but please do tell me if I am missing any details out, posting it on the wrong forum on this website, or whether I should actually post it to another website.
The post is as follows:
I am fairly new to using action script 3.0, I am following a set of video tutorials for such.
I am using Adobe Flash Professional CC 2014, along with some extra elements, to create the main menu for a game using UDK(Unreal Development Kit), that I have in mind, to confirm, this is a test game, not intended for release, it will be free to try when I get various features implemented, a practice project.
So, I am using Scaleform and CLIK. When I run what I have so far, using the Scaleform launcher, everything works as intended, no errors are logged in the console. However, when I use the debugger and click on the 'Options' button on my main menu (it is the only button in frames 1-10, at the moment, under the 'mainMenuScreen' label that I have declared), I get the following error:
ArgumentError: Error #2109: Frame label default not found in scene default.
at flash.display::MovieClip/gotoAndPlay()
at scaleform.clik.controls::Slider/draw()[C:\UDK\UDK-2014-08\Development\Flash\AS3\CLIK\scaleform\clik\contr ols\Slider.as:273]
at scaleform.clik.controls::Slider/set value()[C:\UDK\UDK-2014-08\Development\Flash\AS3\CLIK\scaleform\clik\contr ols\Slider.as:156]
at MainMenu_fla::MainTimeline/frame10()[MainMenu_fla.MainTimeline::frame10:11]
at flash.display::MovieClip/gotoAndPlay()
at MainMenu_fla::MainTimeline/OpenGameplayOptionsScreen()[MainMenu_fla.MainTimeline::frame1:17]
I am not using a label known as 'default', nor do I have a scene called 'default' and also, as can be seen from the code for the button, I am not trying to go to (gotoAndPlay), 'default', I am trying to go to a label I have defined, known as 'gameplayOptionsScreen', the code is as follows:
import flash.events.MouseEvent;
/*Function
#Name: OpenGamePlayOptionsScreen
#Params: None
#Description: This function will make the scene go to the "gameplayOptionsScreen"
label, so that the components that will be on the screen will now be those under the
label of "gameplayOptionsScreen".
*/
function OpenGameplayOptionsScreen(evt : MouseEvent)
{
gotoAndPlay("gameplayOptionsScreen");
}
// Add an event listener to this button, so it can tell if it has been clicked on, // in this case:
optionsBtn.addEventListener("click", OpenGameplayOptionsScreen);
(The line above this one, is where the debugger highlights one of the places the error occurs)
stop(); // Stop the flash movie here
From what problems that the debugger has informed me of, it also seems to have a problem with the slider that appears in frame 10, the frame that the label, 'gameplayOptionsScreen', is assigned too.
But I am wondering why the error occurs, in regards to a call to 'gotoAndPlay("gameplayOptionsScreen");', as that is where I believe the error becomes existent from.
Please do tell me if you require more information to help me solve this problem that I am having, or do tell me if I have posted this in the wrong forum on this website, or if I have in fact posted this to the wrong website altogether and therefore, should be posting to Epic Games' forums instead.
Edit: I have redone the button, so that, it is now known as TestGameButton and DefaultButton is in my library too, as it was in the click components library, this component has been left unchanged this time. Using my new button still produces the same errors and even using the default button does as well. But removing the slider that the debugger also complains about that is displayed in frame 10, removes all the errors, so it seems to be a problem with the slider, I am not sure what though, I have tried putting in a new instance and naming it, but I get similar errors .
Never mind then, I don't mind if this question does not get any answers, I am moving onto UE4, which has much better systems in place for menus, for example, thanks for trying to help #CyanAngel though.

iOS 8 today widget stops working after a while

I've made a today widget for the german ice hockey league DEL.
I'm loading the next games from our server an show them in a tableView. The loading process is started in the proposed method "widgetPerformUpdateWithCompletionHandler". Initially i'm loading some cached data in "viewWillAppear".
Everything works great so far!
But after a while (one day) the widget stops working. When I open the notification center the widget appears normal, but it is never updated again. I have to remove the widget from the notification center and have to add it again. After that the widget works for a day and then again it stops working.
To see what the widget ist doing, I've added a simple white view with a status text above the table view while loading the data in "widgetPerformUpdateWithCompletionHandler" to see if the widget is doing anything. The white view appears when the widget is working. When it is not working the status view doesn't appear. So I think the method "widgetPerformUpdateWithCompletionHandler" isn't called after the widget is active in the notification center for a while.
I've got no clue what causes the widget to stop working. Any ideas?
I've got the same problem and I resolved it by calling completionHandler(NCUpdateResultNoData);
right after your network request even when the response hasn't been returned. I found that if completion handler is not called the widgetPerformUpdateWithCompletionHandler
will no longer get invoked, and therefore there won't be any more updates. Also make sure you call completion handler in all branches after your request call returns.
As others have mentioned, this is caused by not having previous called the completionHandler after widgetPerformUpdateWithCompletionHandler has been called. You need to make sure that completionHandler is called no matter what.
The way I suggest handling this is by saving the completionHandler as an instance variable, and then calling it with failed in viewDidDisappear:
#property(nonatomic, copy) void (^completionHandler)(NCUpdateResult);
#property(nonatomic) BOOL hasSignaled;
- (void)widgetPerformUpdateWithCompletionHandler:(void (^)(NCUpdateResult))completionHandler {
self.completionHandler = completionHandler;
// Do work.
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if (!self.hasSignaled) [self signalComplete:NCUpdateResultFailed];
}
- (void)signalComplete:(NCUpdateResult)updateResult {
NSLog(#"Signaling complete: %lu", updateResult);
self.hasSignaled = YES;
if (self.completionHandler) self.completionHandler(updateResult);
}
An additional problem is that once widgetPerformUpdateWithCompletionHandler: is stopped being called, there will never be another completion handler to call. I haven't found a way to make the system call widgetPerformUpdateWithCompletionHandler: again. Therefore, make sure your widget will also try to reload data through viewWillAppear: as a fallback, or some users might be stuck with a non-loading widget.
Calling the completionHandler with NCUpdateResultNewData within widgetPerformUpdateWithCompletionHandler before an async call comes back and calls it again with NCUpdateResultNewData or NCUpdateResultFailed seems to work.